aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-06-13 08:06:39 +0800
committerDan Finlay <dan@danfinlay.com>2017-06-13 08:17:16 +0800
commita741cc4fc4fb68e3f460c70ea848bdf3d2d2c894 (patch)
tree58652d4789e71a47a763096e746bd25904d91bfe
parentd05d9a5f57b9311d6f29539233f9065330e8bda4 (diff)
parentbbe0c73dca45542b519036bec2bae5feb1e55485 (diff)
downloadtangerine-wallet-browser-a741cc4fc4fb68e3f460c70ea848bdf3d2d2c894.tar.gz
tangerine-wallet-browser-a741cc4fc4fb68e3f460c70ea848bdf3d2d2c894.tar.zst
tangerine-wallet-browser-a741cc4fc4fb68e3f460c70ea848bdf3d2d2c894.zip
Merge branch 'master' into AddTokenList
-rw-r--r--.eslintignore4
-rw-r--r--.eslintrc7
-rw-r--r--.gitignore25
-rw-r--r--CHANGELOG.md95
-rw-r--r--Dockerfile2
-rw-r--r--README.md134
-rw-r--r--app/currencies.json1
-rw-r--r--app/manifest.json4
-rw-r--r--app/scripts/account-import-strategies/index.js2
-rw-r--r--app/scripts/background.js50
-rw-r--r--app/scripts/config.js9
-rw-r--r--app/scripts/contentscript.js3
-rw-r--r--app/scripts/controllers/address-book.js8
-rw-r--r--app/scripts/controllers/currency.js10
-rw-r--r--app/scripts/controllers/network.js129
-rw-r--r--app/scripts/controllers/preferences.js8
-rw-r--r--app/scripts/controllers/transactions.js (renamed from app/scripts/transaction-manager.js)98
-rw-r--r--app/scripts/first-time-state.js12
-rw-r--r--app/scripts/inpage.js21
-rw-r--r--app/scripts/keyring-controller.js4
-rw-r--r--app/scripts/lib/auto-reload.js47
-rw-r--r--app/scripts/lib/buy-eth-url.js8
-rw-r--r--app/scripts/lib/config-manager.js78
-rw-r--r--app/scripts/lib/eth-store.js4
-rw-r--r--app/scripts/lib/inpage-provider.js5
-rw-r--r--app/scripts/lib/message-manager.js4
-rw-r--r--app/scripts/lib/migrator/index.js43
-rw-r--r--app/scripts/lib/notification-manager.js5
-rw-r--r--app/scripts/lib/personal-message-manager.js4
-rw-r--r--app/scripts/lib/tx-utils.js30
-rw-r--r--app/scripts/metamask-controller.js233
-rw-r--r--app/scripts/migrations/002.js2
-rw-r--r--app/scripts/migrations/003.js2
-rw-r--r--app/scripts/migrations/004.js2
-rw-r--r--app/scripts/migrations/005.js2
-rw-r--r--app/scripts/migrations/006.js2
-rw-r--r--app/scripts/migrations/007.js2
-rw-r--r--app/scripts/migrations/008.js2
-rw-r--r--app/scripts/migrations/009.js2
-rw-r--r--app/scripts/migrations/010.js2
-rw-r--r--app/scripts/migrations/011.js2
-rw-r--r--app/scripts/migrations/012.js2
-rw-r--r--app/scripts/migrations/013.js34
-rw-r--r--app/scripts/migrations/014.js34
-rw-r--r--app/scripts/migrations/_multi-keyring.js11
-rw-r--r--app/scripts/migrations/index.js2
-rw-r--r--app/scripts/popup-core.js6
-rw-r--r--app/scripts/popup.js2
-rw-r--r--circle.yml2
-rw-r--r--development/announcer.js2
-rw-r--r--docs/add-to-chrome.md14
-rw-r--r--docs/add-to-firef.md14
-rw-r--r--docs/adding-new-networks.md25
-rw-r--r--docs/developing-on-deps.md10
-rw-r--r--docs/development-visualization.md35
-rw-r--r--docs/notices.md15
-rw-r--r--docs/publishing.md19
-rw-r--r--docs/ui-dev-mode.md6
-rw-r--r--docs/ui-mock-mode.md8
-rw-r--r--gulpfile.js14
-rw-r--r--mascara/README.md31
-rw-r--r--mascara/src/background.js14
-rw-r--r--mascara/src/lib/index-db-controller.js88
-rw-r--r--mascara/src/mascara.js5
-rw-r--r--mascara/src/proxy.js1
-rw-r--r--mascara/src/ui.js16
-rw-r--r--mascara/test/helpers.js7
-rw-r--r--mascara/test/index.html21
-rw-r--r--mascara/test/index.js22
-rw-r--r--mascara/test/jquery-3.1.0.min.js4
-rw-r--r--mascara/test/lib/first-time.js119
-rw-r--r--mascara/test/testem.yml13
-rw-r--r--mascara/test/util/mascara-test-helper.js40
-rw-r--r--mascara/test/window-load.js5
-rw-r--r--mascara/ui/index.html3
-rw-r--r--notices/archive/notice_1.md1
-rw-r--r--notices/archive/notice_2.md8
-rw-r--r--notices/notice-nonce.json2
-rw-r--r--notices/notices.json2
-rw-r--r--package.json35
-rw-r--r--test/helper.js8
-rw-r--r--test/integration/helpers.js4
-rw-r--r--test/integration/index.js8
-rw-r--r--test/integration/lib/first-time.js2
-rw-r--r--test/lib/migrations/001.json15
-rw-r--r--test/lib/mock-config-manager.js7
-rw-r--r--test/lib/mock-encryptor.js12
-rw-r--r--test/lib/mock-simple-keychain.js14
-rw-r--r--test/lib/mock-store.js18
-rw-r--r--test/unit/account-link-test.js8
-rw-r--r--test/unit/actions/config_test.js23
-rw-r--r--test/unit/actions/save_account_label_test.js21
-rw-r--r--test/unit/actions/set_selected_account_test.js23
-rw-r--r--test/unit/actions/tx_test.js92
-rw-r--r--test/unit/actions/view_info_test.js15
-rw-r--r--test/unit/actions/warning_test.js13
-rw-r--r--test/unit/address-book-controller.js16
-rw-r--r--test/unit/components/binary-renderer-test.js10
-rw-r--r--test/unit/components/bn-as-decimal-input-test.js51
-rw-r--r--test/unit/components/pending-tx-test.js77
-rw-r--r--test/unit/config-manager-test.js42
-rw-r--r--test/unit/currency-controller-test.js43
-rw-r--r--test/unit/explorer-link-test.js8
-rw-r--r--test/unit/keyring-controller-test.js61
-rw-r--r--test/unit/linting_test.js6
-rw-r--r--test/unit/message-manager-test.js41
-rw-r--r--test/unit/metamask-controller-test.js16
-rw-r--r--test/unit/migrations-test.js10
-rw-r--r--test/unit/migrator-test.js41
-rw-r--r--test/unit/nameForAccount_test.js17
-rw-r--r--test/unit/network-contoller-test.js77
-rw-r--r--test/unit/nodeify-test.js8
-rw-r--r--test/unit/notice-controller-test.js71
-rw-r--r--test/unit/personal-message-manager-test.js47
-rw-r--r--test/unit/reducers/unlock_vault_test.js27
-rw-r--r--test/unit/tx-controller-test.js323
-rw-r--r--test/unit/tx-manager-test.js241
-rw-r--r--test/unit/tx-utils-test.js32
-rw-r--r--test/unit/util_test.js119
-rw-r--r--ui/app/account-detail.js34
-rw-r--r--ui/app/accounts/account-list-item.js5
-rw-r--r--ui/app/accounts/import/index.js2
-rw-r--r--ui/app/accounts/index.js6
-rw-r--r--ui/app/actions.js26
-rw-r--r--ui/app/app.js14
-rw-r--r--ui/app/components/balance.js3
-rw-r--r--ui/app/components/bn-as-decimal-input.js174
-rw-r--r--ui/app/components/buy-button-subview.js147
-rw-r--r--ui/app/components/coinbase-form.js114
-rw-r--r--ui/app/components/copyable.js46
-rw-r--r--ui/app/components/custom-radio-list.js60
-rw-r--r--ui/app/components/drop-menu-item.js5
-rw-r--r--ui/app/components/ens-input.js26
-rw-r--r--ui/app/components/eth-balance.js16
-rw-r--r--ui/app/components/fiat-value.js20
-rw-r--r--ui/app/components/hex-as-decimal-input.js2
-rw-r--r--ui/app/components/identicon.js19
-rw-r--r--ui/app/components/network.js14
-rw-r--r--ui/app/components/notice.js7
-rw-r--r--ui/app/components/pending-tx.js194
-rw-r--r--ui/app/components/qr-code.js12
-rw-r--r--ui/app/components/shapeshift-form.js34
-rw-r--r--ui/app/components/shift-list-item.js12
-rw-r--r--ui/app/components/transaction-list-item-icon.js18
-rw-r--r--ui/app/components/transaction-list-item.js31
-rw-r--r--ui/app/components/transaction-list.js3
-rw-r--r--ui/app/conf-tx.js17
-rw-r--r--ui/app/config.js7
-rw-r--r--ui/app/conversion.json5937
-rw-r--r--ui/app/css/index.css41
-rw-r--r--ui/app/css/lib.css4
-rw-r--r--ui/app/info.js19
-rw-r--r--ui/app/reducers.js1
-rw-r--r--ui/app/reducers/app.js37
-rw-r--r--ui/app/send.js24
-rw-r--r--ui/app/util.js1
-rw-r--r--ui/lib/account-link.js3
-rw-r--r--ui/lib/contract-namer.js12
-rw-r--r--ui/lib/explorer-link.js3
-rw-r--r--ui/lib/icon-factory.js63
160 files changed, 3175 insertions, 7504 deletions
diff --git a/.eslintignore b/.eslintignore
index df49525be..b96f79011 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1 +1,5 @@
app/scripts/lib/extension-instance.js
+test/integration/bundle.js
+test/integration/jquery-3.1.0.min.js
+test/integration/helpers.js
+test/integration/lib/first-time.js \ No newline at end of file
diff --git a/.eslintrc b/.eslintrc
index 8bbfe13c7..a57a93cdc 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,7 +1,7 @@
{
"parserOptions": {
"sourceType": "module",
- "ecmaVersion": 6,
+ "ecmaVersion": 2017,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"impliedStrict": true,
@@ -17,10 +17,13 @@
"env": {
"es6": true,
"node": true,
- "browser": true
+ "browser": true,
+ "mocha" : true
},
"plugins": [
+ "mocha",
+ "chai"
],
"globals": {
diff --git a/.gitignore b/.gitignore
index c61847aab..85c2d15d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,18 +1,27 @@
-dist
npm-debug.log
node_modules
-temp
-.tmp
-.sass-cache
+package-lock.json
+
app/bower_components
test/bower_components
package
+
+temp
+.tmp
+.sass-cache
.DS_Store
+app/.DS_Store
+
+dist
builds/
disc/
-notes.txt
-app/.DS_Store
-development/bundle.js
builds.zip
-test/integration/bundle.js
+
+development/bundle.js
development/states.js
+test/integration/bundle.js
+test/background.js
+test/bundle.js
+test/test-bundle.js
+
+notes.txt \ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fd754cadd..167a34828 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,8 +2,103 @@
## Current Master
+## 3.7.8 2017-6-12
+
+- Add a `ethereum:` prefix to the QR code address
+- The default network on installation is now MainNet
+- Fix currency API URL from cryptonator.
+- Update gasLimit params with every new block seen.
+
+## 3.7.7 2017-6-8
+
+- Fix bug where metamask would show old data after computer being asleep or disconnected from the internet.
+
+## 3.7.6 2017-6-5
+
+- Fix bug that prevented publishing contracts.
+
+## 3.7.5 2017-6-5
+
+- Prevent users from sending to the `0x0` address.
+- Provide useful errors when entering bad characters in ENS name.
+- Add ability to copy addresses from transaction confirmation view.
+
+## 3.7.4 2017-6-2
+
+- Fix bug with inflight cache that caused some block lookups to return bad values (affected OasisDex).
+- Fixed bug with gas limit calculation that would sometimes create unsubmittable gas limits.
+
+## 3.7.3 2017-6-1
+
+- Rebuilt to fix cache clearing bug.
+
+## 3.7.2 2017-5-31
+
+- Now when switching networks sites that use web3 will reload
+- Now when switching networks the extension does not restart
+- Cleanup decimal bugs in our gas inputs.
+- Fix bug where submit button was enabled for invalid gas inputs.
+- Now enforce 95% of block's gasLimit to protect users.
+- Removing provider-engine from the inpage provider. This fixes some error handling inconsistencies introduced in 3.7.0.
+- Added "inflight cache", which prevents identical requests from clogging up the network, dramatically improving ENS performance.
+- Fixed bug where filter subscriptions would sometimes fail to unsubscribe.
+- Some contracts will now display logos instead of jazzicons.
+- Some contracts will now have names displayed in the confirmation view.
+
+## 3.7.0 2017-5-23
+
+- Add Transaction Number (nonce) to transaction list.
+- Label the pending tx icon with a tooltip.
+- Fix bug where website filters would pile up and not deallocate when leaving a site.
+- Continually resubmit pending txs for a period of time to ensure successful broadcast.
+- ENS names will no longer resolve to their owner if no resolver is set. Resolvers must be explicitly set and configured.
+
+## 3.6.5 2017-5-17
+
+- Fix bug where edited gas parameters would not take effect.
+- Trim currency list.
+- Enable decimals in our gas prices.
+- Fix reset button.
+- Fix event filter bug introduced by newer versions of Geth.
+- Fix bug where decimals in gas inputs could result in strange values.
+
+## 3.6.4 2017-5-8
+
+- Fix main-net ENS resolution.
+
+## 3.6.3 2017-5-8
+
+- Fix bug that could stop newer versions of Geth from working with MetaMask.
+
+## 3.6.2 2017-5-8
+
+- Input gas price in Gwei.
+- Enforce Safe Gas Minimum recommended by EthGasStation.
+- Fix bug where block-tracker could stop polling for new blocks.
+- Reduce UI size by removing internal web3.
+- Fix bug where gas parameters would not properly update on adjustment.
+
+## 3.6.1 2017-4-30
+
+- Made fox less nosy.
+- Fix bug where error was reported in debugger console when Chrome opened a new window.
+
+## 3.6.0 2017-4-26
+
+- Add Rinkeby Test Network to our network list.
+
+## 3.5.4 2017-4-25
+
+- Fix occasional nonce tracking issue.
+- Fix bug where some events would not be emitted by web3.
+- Fix bug where an error would be thrown when composing signatures for networks with large ID values.
+
+## 3.5.3 2017-4-24
+
- Popup new transactions in Firefox.
- Fix transition issue from account detail screen.
+- Revise buy screen for more modularity.
+- Fixed some other small bugs.
## 3.5.2 2017-3-28
diff --git a/Dockerfile b/Dockerfile
index d06f5377b..be0a328fe 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM node:6
+FROM node:7
MAINTAINER kumavis
# setup app dir
diff --git a/README.md b/README.md
index aa79f4564..afeb96ae5 100644
--- a/README.md
+++ b/README.md
@@ -18,11 +18,15 @@ If you're a web dapp developer, we've got two types of guides for you:
Uncompressed builds can be found in `/dist`, compressed builds can be found in `/builds` once they're built.
-## Installing Local Builds on Chrome
+### Running Tests
+
+Requires `mocha` installed. Run `npm install -g mocha`.
-To install your locally built extension on Chrome, [follow this guide](http://stackoverflow.com/a/24577660/272576).
+Then just run `npm test`.
-The built extension is stored in `./dist/chrome/`.
+You can also test with a continuously watching process, via `npm run watch`.
+
+You can run the linter by itself with `gulp lint`.
## Architecture
@@ -41,126 +45,22 @@ npm start
npm run dist
```
-#### In Chrome
-
-Open `Settings` > `Extensions`.
-
-Check "Developer mode".
-
-At the top, click `Load Unpacked Extension`.
-
-Navigate to your `metamask-plugin/dist/chrome` folder.
-
-Click `Select`.
-
-You now have the plugin, and can click 'inspect views: background plugin' to view its dev console.
-
-#### In Firefox
-
-Go to the url `about:debugging`.
-
-Click the button `Load Temporary Add-On`.
-
-Select the file `dist/firefox/manifest.json`.
-
-You can optionally enable debugging, and click `Debug`, for a console window that logs all of Metamask's processes to a single console.
-
-If you have problems debugging, try connecting to the IRC channel `#webextensions` on `irc.mozilla.org`.
-
-For longer questions, use the StackOverfow tag `firefox-addons`.
-
-### Developing on UI Only
-
-You can run `npm run ui`, and your browser should open a live-reloading demo version of the plugin UI.
-
-Some actions will crash the app, so this is only for tuning aesthetics, but it allows live-reloading styles, which is a much faster feedback loop than reloading the full extension.
-
-### Developing on UI with Mocked Background Process
-
-You can run `npm run mock` and your browser should open a live-reloading demo version of the plugin UI, just like the `npm run ui`, except that it tries to actually perform all normal operations.
-
-It does not yet connect to a real blockchain (this could be a good test feature later, connecting to a test blockchain), so only local operations work.
-
-You can reset the mock ui at any time with the `Reset` button at the top of the screen.
-
-### Developing on Dependencies
-
-To enjoy the live-reloading that `gulp dev` offers while working on the `web3-provider-engine` or other dependencies:
-
- 1. Clone the dependency locally.
- 2. `npm install` in its folder.
- 3. Run `npm link` in its folder.
- 4. Run `npm link $DEP_NAME` in this project folder.
- 5. Next time you `npm start` it will watch the dependency for changes as well!
-
-### Running Tests
-
-Requires `mocha` installed. Run `npm install -g mocha`.
-
-Then just run `npm test`.
-
-You can also test with a continuously watching process, via `npm run watch`.
-
-You can run the linter by itself with `gulp lint`.
-
#### Writing Browser Tests
To write tests that will be run in the browser using QUnit, add your test files to `test/integration/lib`.
-### Deploying the UI
-
- You must be authorized already on the MetaMask plugin.
+## Other Docs
- 0. Update the version in `app/manifest.json` and the Changelog in `CHANGELOG.md`.
- 1. Visit [the chrome developer dashboard](https://chrome.google.com/webstore/developer/dashboard?authuser=2).
- 2. Run `gulp dist` (or `gulp zip` if you've already built)
- 3. Upload the latest zip file from `builds/metamask-$PLATFORM-$VERSION.zip` as the updated package.
+- [How to add custom build to Chrome](./docs/add-to-chrome.md)
+- [How to add custom build to Firefox](./docs/add-to-firefox.md)
+- [How to develop a live-reloading UI](./docs/ui-dev-mode.md)
+- [Publishing Guide](./docs/publishing.md)
+- [How to develop an in-browser mocked UI](./docs/ui-mock-mode.md)
+- [How to live reload on local dependency changes](./docs/developing-on-deps.md)
+- [How to add new networks to the Provider Menu](./docs/adding-new-networks.md)
+- [How to manage notices that appear when the app starts up](./docs/notices.md)
+- [How to generate a visualization of this repository's development](./docs/development-visualization.md)
[1]: http://www.nomnoml.com/#view/%5B%3Cactor%3Euser%5D%0A%0A%5Bmetamask-ui%7C%0A%20%20%20%5Btools%7C%0A%20%20%20%20%20react%0A%20%20%20%20%20redux%0A%20%20%20%20%20thunk%0A%20%20%20%20%20ethUtils%0A%20%20%20%20%20jazzicon%0A%20%20%20%5D%0A%20%20%20%5Bcomponents%7C%0A%20%20%20%20%20app%0A%20%20%20%20%20account-detail%0A%20%20%20%20%20accounts%0A%20%20%20%20%20locked-screen%0A%20%20%20%20%20restore-vault%0A%20%20%20%20%20identicon%0A%20%20%20%20%20config%0A%20%20%20%20%20info%0A%20%20%20%5D%0A%20%20%20%5Breducers%7C%0A%20%20%20%20%20app%0A%20%20%20%20%20metamask%0A%20%20%20%20%20identities%0A%20%20%20%5D%0A%20%20%20%5Bactions%7C%0A%20%20%20%20%20%5BaccountManager%5D%0A%20%20%20%5D%0A%20%20%20%5Bcomponents%5D%3A-%3E%5Bactions%5D%0A%20%20%20%5Bactions%5D%3A-%3E%5Breducers%5D%0A%20%20%20%5Breducers%5D%3A-%3E%5Bcomponents%5D%0A%5D%0A%0A%5Bweb%20dapp%7C%0A%20%20%5Bui%20code%5D%0A%20%20%5Bweb3%5D%0A%20%20%5Bmetamask-inpage%5D%0A%20%20%0A%20%20%5B%3Cactor%3Eui%20developer%5D%0A%20%20%5Bui%20developer%5D-%3E%5Bui%20code%5D%0A%20%20%5Bui%20code%5D%3C-%3E%5Bweb3%5D%0A%20%20%5Bweb3%5D%3C-%3E%5Bmetamask-inpage%5D%0A%5D%0A%0A%5Bmetamask-background%7C%0A%20%20%5Bprovider-engine%5D%0A%20%20%5Bhooked%20wallet%20subprovider%5D%0A%20%20%5Bid%20store%5D%0A%20%20%0A%20%20%5Bprovider-engine%5D%3C-%3E%5Bhooked%20wallet%20subprovider%5D%0A%20%20%5Bhooked%20wallet%20subprovider%5D%3C-%3E%5Bid%20store%5D%0A%20%20%5Bconfig%20manager%7C%0A%20%20%20%20%5Brpc%20configuration%5D%0A%20%20%20%20%5Bencrypted%20keys%5D%0A%20%20%20%20%5Bwallet%20nicknames%5D%0A%20%20%5D%0A%20%20%0A%20%20%5Bprovider-engine%5D%3C-%5Bconfig%20manager%5D%0A%20%20%5Bid%20store%5D%3C-%3E%5Bconfig%20manager%5D%0A%5D%0A%0A%5Buser%5D%3C-%3E%5Bmetamask-ui%5D%0A%0A%5Buser%5D%3C%3A--%3A%3E%5Bweb%20dapp%5D%0A%0A%5Bmetamask-contentscript%7C%0A%20%20%5Bplugin%20restart%20detector%5D%0A%20%20%5Brpc%20passthrough%5D%0A%5D%0A%0A%5Brpc%20%7C%0A%20%20%5Bethereum%20blockchain%20%7C%0A%20%20%20%20%5Bcontracts%5D%0A%20%20%20%20%5Baccounts%5D%0A%20%20%5D%0A%5D%0A%0A%5Bweb%20dapp%5D%3C%3A--%3A%3E%5Bmetamask-contentscript%5D%0A%5Bmetamask-contentscript%5D%3C-%3E%5Bmetamask-background%5D%0A%5Bmetamask-background%5D%3C-%3E%5Bmetamask-ui%5D%0A%5Bmetamask-background%5D%3C-%3E%5Brpc%5D%0A
-### Generate Development Visualization
-
-This will generate a video of the repo commit history.
-
-Install preqs:
-```
-brew install gource
-brew install ffmpeg
-```
-
-From the repo dir, pipe `gource` into `ffmpeg`:
-```
-gource \
- --seconds-per-day .1 \
- --user-scale 1.5 \
- --default-user-image "./images/icon-512.png" \
- --viewport 1280x720 \
- --auto-skip-seconds .1 \
- --multi-sampling \
- --stop-at-end \
- --highlight-users \
- --hide mouse,progress \
- --file-idle-time 0 \
- --max-files 0 \
- --background-colour 000000 \
- --font-size 18 \
- --date-format "%b %d, %Y" \
- --highlight-dirs \
- --user-friction 0.1 \
- --title "MetaMask Development History" \
- --output-ppm-stream - \
- --output-framerate 30 \
- | ffmpeg -y -r 30 -f image2pipe -vcodec ppm -i - -b 65536K metamask-dev-history.mp4
-```
-
-## Generating Notices
-
-To add a notice:
-```
-npm run generateNotice
-```
-To delete a notice:
-```
-npm run deleteNotice
-```
diff --git a/app/currencies.json b/app/currencies.json
deleted file mode 100644
index 07889798b..000000000
--- a/app/currencies.json
+++ /dev/null
@@ -1 +0,0 @@
-{"rows":[{"code":"007","name":"007","statuses":["primary"]},{"code":"1337","name":"1337","statuses":["primary"]},{"code":"1CR","name":"1CR","statuses":["primary"]},{"code":"256","name":"256","statuses":["primary"]},{"code":"2FLAV","name":"2FLAV","statuses":["primary"]},{"code":"2GIVE","name":"2GIVE","statuses":["primary"]},{"code":"404","name":"404","statuses":["primary"]},{"code":"611","name":"611","statuses":["primary"]},{"code":"888","name":"888","statuses":["primary"]},{"code":"8BIT","name":"8Bit","statuses":["primary"]},{"code":"ACLR","name":"ACLR","statuses":["primary"]},{"code":"ACOIN","name":"ACOIN","statuses":["primary"]},{"code":"ACP","name":"ACP","statuses":["primary"]},{"code":"ADC","name":"ADC","statuses":["primary"]},{"code":"ADZ","name":"Adzcoin","statuses":["primary"]},{"code":"AEC","name":"AEC","statuses":["primary"]},{"code":"AEON","name":"Aeon","statuses":["primary"]},{"code":"AGRS","name":"Agoras Tokens","statuses":["primary"]},{"code":"AIB","name":"AIB","statuses":["primary"]},{"code":"ADN","name":"Aiden","statuses":["primary"]},{"code":"AIR","name":"AIR","statuses":["primary"]},{"code":"ALC","name":"ALC","statuses":["primary"]},{"code":"ALTC","name":"ALTC","statuses":["primary"]},{"code":"AM","name":"AM","statuses":["primary"]},{"code":"AMBER","name":"AMBER","statuses":["primary"]},{"code":"AMS","name":"AMS","statuses":["primary"]},{"code":"ANAL","name":"ANAL","statuses":["primary"]},{"code":"AND","name":"AND","statuses":["primary"]},{"code":"ANI","name":"ANI","statuses":["primary"]},{"code":"ANC","name":"Anoncoin","statuses":["primary"]},{"code":"ANTI","name":"AntiBitcoin","statuses":["primary"]},{"code":"APEX","name":"APEX","statuses":["primary"]},{"code":"APC","name":"Applecoin","statuses":["primary"]},{"code":"APT","name":"APT","statuses":["primary"]},{"code":"AR2","name":"AR2","statuses":["primary"]},{"code":"ARB","name":"ARB","statuses":["primary"]},{"code":"ARC","name":"ARC","statuses":["primary"]},{"code":"ARCH","name":"ARCH","statuses":["primary"]},{"code":"ABY","name":"ArtByte","statuses":["primary"]},{"code":"ARTC","name":"ARTC","statuses":["primary"]},{"code":"ADCN","name":"Asiadigicoin","statuses":["primary"]},{"code":"ATEN","name":"ATEN","statuses":["primary"]},{"code":"REP","name":"Augur","statuses":["primary"]},{"code":"AUR","name":"Auroracoin","statuses":["primary"]},{"code":"AUD","name":"Australian Dollar","statuses":["secondary"]},{"code":"AV","name":"AV","statuses":["primary"]},{"code":"BA","name":"BA","statuses":["primary"]},{"code":"BAC","name":"BAC","statuses":["primary"]},{"code":"BTA","name":"Bata","statuses":["primary"]},{"code":"BAY","name":"BAY","statuses":["primary"]},{"code":"BBCC","name":"BBCC","statuses":["primary"]},{"code":"BQC","name":"BBQCoin","statuses":["primary"]},{"code":"BDC","name":"BDC","statuses":["primary"]},{"code":"BEC","name":"BEC","statuses":["primary"]},{"code":"BEEZ","name":"BEEZ","statuses":["primary"]},{"code":"BELA","name":"BellaCoin","statuses":["primary"]},{"code":"BERN","name":"BERNcash","statuses":["primary"]},{"code":"BILL","name":"BILL","statuses":["primary"]},{"code":"BILS","name":"BILS","statuses":["primary"]},{"code":"BIOS","name":"BiosCrypto","statuses":["primary"]},{"code":"BIT","name":"BIT","statuses":["primary"]},{"code":"BIT16","name":"BIT16","statuses":["primary"]},{"code":"BITB","name":"BitBean","statuses":["primary"]},{"code":"BTC","name":"Bitcoin","statuses":["primary","secondary"]},{"code":"XBC","name":"Bitcoin Plus","statuses":["primary"]},{"code":"BTCD","name":"BitcoinDark","statuses":["primary"]},{"code":"BCY","name":"Bitcrystals","statuses":["primary"]},{"code":"BTM","name":"Bitmark","statuses":["primary"]},{"code":"BTQ","name":"BitQuark","statuses":["primary"]},{"code":"BITS","name":"BITS","statuses":["primary"]},{"code":"BSD","name":"BitSend","statuses":["primary"]},{"code":"BTS","name":"BitShares","statuses":["primary"]},{"code":"PTS","name":"BitShares PTS","statuses":["primary"]},{"code":"SWIFT","name":"BitSwift","statuses":["primary"]},{"code":"BITZ","name":"Bitz","statuses":["primary"]},{"code":"BLK","name":"Blackcoin","statuses":["primary"]},{"code":"JACK","name":"BlackJack","statuses":["primary"]},{"code":"BLC","name":"Blakecoin","statuses":["primary"]},{"code":"BLEU","name":"BLEU","statuses":["primary"]},{"code":"BLITZ","name":"Blitzcoin","statuses":["primary"]},{"code":"BLOCK","name":"Blocknet","statuses":["primary"]},{"code":"BLRY","name":"BLRY","statuses":["primary"]},{"code":"BLU","name":"BLU","statuses":["primary"]},{"code":"BM","name":"BM","statuses":["primary"]},{"code":"BNT","name":"BNT","statuses":["primary"]},{"code":"BOB","name":"BOB","statuses":["primary"]},{"code":"BON","name":"BON","statuses":["primary"]},{"code":"BBR","name":"Boolberry","statuses":["primary"]},{"code":"BOST","name":"BoostCoin","statuses":["primary"]},{"code":"BOSS","name":"BOSS","statuses":["primary"]},{"code":"BPOK","name":"BPOK","statuses":["primary"]},{"code":"BRAIN","name":"BRAIN","statuses":["primary"]},{"code":"BRC","name":"BRC","statuses":["primary"]},{"code":"BRDD","name":"BRDD","statuses":["primary"]},{"code":"BRIT","name":"BRIT","statuses":["primary"]},{"code":"GBP","name":"British Pound Sterling","statuses":["secondary"]},{"code":"BRK","name":"BRK","statuses":["primary"]},{"code":"BRX","name":"BRX","statuses":["primary"]},{"code":"BSC","name":"BSC","statuses":["primary"]},{"code":"BST","name":"BST","statuses":["primary"]},{"code":"BTCHC","name":"BTCHC","statuses":["primary"]},{"code":"BTCR","name":"BTCR","statuses":["primary"]},{"code":"BTCS","name":"BTCS","statuses":["primary"]},{"code":"BTCU","name":"BTCU","statuses":["primary"]},{"code":"BTTF","name":"BTTF","statuses":["primary"]},{"code":"BTX","name":"BTX","statuses":["primary"]},{"code":"BUCKS","name":"BUCKS","statuses":["primary"]},{"code":"BUN","name":"BUN","statuses":["primary"]},{"code":"BURST","name":"Burst","statuses":["primary"]},{"code":"BUZZ","name":"BUZZ","statuses":["primary"]},{"code":"BVC","name":"BVC","statuses":["primary"]},{"code":"BYC","name":"Bytecent","statuses":["primary"]},{"code":"BCN","name":"Bytecoin","statuses":["primary"]},{"code":"XCT","name":"C-Bit","statuses":["primary"]},{"code":"C0C0","name":"C0C0","statuses":["primary"]},{"code":"CAB","name":"Cabbage Unit","statuses":["primary"]},{"code":"CAD","name":"CAD","statuses":["primary","secondary"]},{"code":"CAGE","name":"CAGE","statuses":["primary"]},{"code":"CANN","name":"CannabisCoin","statuses":["primary"]},{"code":"CCN","name":"Cannacoin","statuses":["primary"]},{"code":"CPC","name":"Capricoin","statuses":["primary"]},{"code":"DIEM","name":"CarpeDiemCoin","statuses":["primary"]},{"code":"CASH","name":"CASH","statuses":["primary"]},{"code":"CBIT","name":"CBIT","statuses":["primary"]},{"code":"CC","name":"CC","statuses":["primary"]},{"code":"CCB","name":"CCB","statuses":["primary"]},{"code":"CD","name":"CD","statuses":["primary"]},{"code":"CDN","name":"CDN","statuses":["primary"]},{"code":"CF","name":"CF","statuses":["primary"]},{"code":"CFC","name":"CFC","statuses":["primary"]},{"code":"CGA","name":"CGA","statuses":["primary"]},{"code":"CHC","name":"CHC","statuses":["primary"]},{"code":"CKC","name":"Checkcoin","statuses":["primary"]},{"code":"CHEMX","name":"CHEMX","statuses":["primary"]},{"code":"CHESS","name":"CHESS","statuses":["primary"]},{"code":"CHF","name":"CHF","statuses":["primary","secondary"]},{"code":"CNY","name":"Chinese Yuan","statuses":["secondary"]},{"code":"CHRG","name":"CHRG","statuses":["primary"]},{"code":"CJ","name":"CJ","statuses":["primary"]},{"code":"CLAM","name":"Clams","statuses":["primary"]},{"code":"CLICK","name":"CLICK","statuses":["primary"]},{"code":"CLINT","name":"CLINT","statuses":["primary"]},{"code":"CLOAK","name":"Cloakcoin","statuses":["primary"]},{"code":"CLR","name":"CLR","statuses":["primary"]},{"code":"CLUB","name":"CLUB","statuses":["primary"]},{"code":"CLUD","name":"CLUD","statuses":["primary"]},{"code":"CMT","name":"CMT","statuses":["primary"]},{"code":"CNC","name":"CNC","statuses":["primary"]},{"code":"COXST","name":"CoExistCoin","statuses":["primary"]},{"code":"COIN","name":"COIN","statuses":["primary"]},{"code":"C2","name":"Coin2.1","statuses":["primary"]},{"code":"CNMT","name":"Coinomat","statuses":["primary"]},{"code":"CV2","name":"Colossuscoin2.0","statuses":["primary"]},{"code":"CON","name":"CON","statuses":["primary"]},{"code":"XCP","name":"Counterparty","statuses":["primary"]},{"code":"COV","name":"COV","statuses":["primary"]},{"code":"CRAFT","name":"CRAFT","statuses":["primary"]},{"code":"CRAVE","name":"CRAVE","statuses":["primary"]},{"code":"CRC","name":"CRC","statuses":["primary"]},{"code":"CRE","name":"CRE","statuses":["primary"]},{"code":"CRBIT","name":"Creditbit","statuses":["primary"]},{"code":"CREVA","name":"CrevaCoin","statuses":["primary"]},{"code":"CRIME","name":"CRIME","statuses":["primary"]},{"code":"CRT","name":"CRT","statuses":["primary"]},{"code":"CRW","name":"CRW","statuses":["primary"]},{"code":"CRY","name":"CRY","statuses":["primary"]},{"code":"XCR","name":"Crypti","statuses":["primary"]},{"code":"CBX","name":"Crypto Bullion","statuses":["primary"]},{"code":"CESC","name":"CryptoEscudo","statuses":["primary"]},{"code":"XCN","name":"Cryptonite","statuses":["primary"]},{"code":"CSMIC","name":"CSMIC","statuses":["primary"]},{"code":"CST","name":"CST","statuses":["primary"]},{"code":"CTC","name":"CTC","statuses":["primary"]},{"code":"CTO","name":"CTO","statuses":["primary"]},{"code":"CURE","name":"Curecoin","statuses":["primary"]},{"code":"CYP","name":"Cypher","statuses":["primary"]},{"code":"CZC","name":"CZC","statuses":["primary"]},{"code":"CZECO","name":"CZECO","statuses":["primary"]},{"code":"CZR","name":"CZR","statuses":["primary"]},{"code":"DAO","name":"DAO","statuses":["primary"]},{"code":"DGD","name":"DarkGoldCoin","statuses":["primary"]},{"code":"DNET","name":"Darknet","statuses":["primary"]},{"code":"DASH","name":"Dash","statuses":["primary"]},{"code":"DTC","name":"Datacoin","statuses":["primary"]},{"code":"DBG","name":"DBG","statuses":["primary"]},{"code":"DBLK","name":"DBLK","statuses":["primary"]},{"code":"DBTC","name":"DBTC","statuses":["primary"]},{"code":"DCK","name":"DCK","statuses":["primary"]},{"code":"DCR","name":"Decred","statuses":["primary"]},{"code":"DES","name":"Destiny","statuses":["primary"]},{"code":"DETH","name":"DETH","statuses":["primary"]},{"code":"DEUR","name":"DEUR","statuses":["primary"]},{"code":"DEM","name":"Deutsche eMark","statuses":["primary"]},{"code":"DVC","name":"Devcoin","statuses":["primary"]},{"code":"DGCS","name":"DGCS","statuses":["primary"]},{"code":"DGMS","name":"DGMS","statuses":["primary"]},{"code":"DGORE","name":"DGORE","statuses":["primary"]},{"code":"DMD","name":"Diamond","statuses":["primary"]},{"code":"DGB","name":"Digibyte","statuses":["primary"]},{"code":"CUBE","name":"DigiCube","statuses":["primary"]},{"code":"DGC","name":"Digitalcoin","statuses":["primary"]},{"code":"XDN","name":"DigitalNote","statuses":["primary"]},{"code":"DP","name":"DigitalPrice","statuses":["primary"]},{"code":"DIGS","name":"DIGS","statuses":["primary"]},{"code":"DIME","name":"Dimecoin","statuses":["primary"]},{"code":"DISK","name":"DISK","statuses":["primary"]},{"code":"DLISK","name":"DLISK","statuses":["primary"]},{"code":"NOTE","name":"DNotes","statuses":["primary"]},{"code":"DOGE","name":"DOGE","statuses":["primary","secondary"]},{"code":"DOGE","name":"Dogecoin","statuses":["primary","secondary"]},{"code":"DON","name":"DON","statuses":["primary"]},{"code":"DOPE","name":"DopeCoin","statuses":["primary"]},{"code":"DOX","name":"DOX","statuses":["primary"]},{"code":"DRACO","name":"DRACO","statuses":["primary"]},{"code":"DRM","name":"DRM","statuses":["primary"]},{"code":"DROP","name":"DROP","statuses":["primary"]},{"code":"DRZ","name":"DRZ","statuses":["primary"]},{"code":"DSH","name":"DSH","statuses":["primary"]},{"code":"DBIC","name":"DubaiCoin","statuses":["primary"]},{"code":"DUO","name":"DUO","statuses":["primary"]},{"code":"DUST","name":"DUST","statuses":["primary"]},{"code":"EAC","name":"Earthcoin","statuses":["primary"]},{"code":"ECCHI","name":"ECCHI","statuses":["primary"]},{"code":"ECC","name":"ECCoin","statuses":["primary"]},{"code":"ECOS","name":"ECOS","statuses":["primary"]},{"code":"EDC","name":"EDC","statuses":["primary"]},{"code":"EDRC","name":"EDRC","statuses":["primary"]},{"code":"EGG","name":"EGG","statuses":["primary"]},{"code":"EMC2","name":"Einsteinium","statuses":["primary"]},{"code":"EKO","name":"EKO","statuses":["primary"]},{"code":"EL","name":"EL","statuses":["primary"]},{"code":"ELCO","name":"ELcoin","statuses":["primary"]},{"code":"ELE","name":"ELE","statuses":["primary"]},{"code":"EFL","name":"Electronic Gulden","statuses":["primary"]},{"code":"EMC","name":"Emercoin","statuses":["primary"]},{"code":"EMIRG","name":"EMIRG","statuses":["primary"]},{"code":"ENE","name":"ENE","statuses":["primary"]},{"code":"ENRG","name":"Energycoin","statuses":["primary"]},{"code":"EPC","name":"EPC","statuses":["primary"]},{"code":"EPY","name":"EPY","statuses":["primary"]},{"code":"ERC","name":"ERC","statuses":["primary"]},{"code":"ERC3","name":"ERC3","statuses":["primary"]},{"code":"ESC","name":"ESC","statuses":["primary"]},{"code":"ETH","name":"Ethereum","statuses":["primary","secondary"]},{"code":"ETC","name":"Ethereum Classic","statuses":["primary"]},{"code":"ETHS","name":"ETHS","statuses":["primary"]},{"code":"EURC","name":"EURC","statuses":["primary"]},{"code":"EUR","name":"Euro","statuses":["primary","secondary"]},{"code":"EGC","name":"EvergreenCoin","statuses":["primary"]},{"code":"EVIL","name":"EVIL","statuses":["primary"]},{"code":"EVO","name":"EVO","statuses":["primary"]},{"code":"EXCL","name":"EXCL","statuses":["primary"]},{"code":"EXIT","name":"EXIT","statuses":["primary"]},{"code":"EXP","name":"Expanse","statuses":["primary"]},{"code":"FCT","name":"Factom","statuses":["primary"]},{"code":"FAIR","name":"Faircoin","statuses":["primary"]},{"code":"FC2","name":"FC2","statuses":["primary"]},{"code":"FCN","name":"FCN","statuses":["primary"]},{"code":"FTC","name":"Feathercoin","statuses":["primary"]},{"code":"TIPS","name":"Fedoracoin","statuses":["primary"]},{"code":"FFC","name":"FFC","statuses":["primary"]},{"code":"FIBRE","name":"Fibre","statuses":["primary"]},{"code":"FIT","name":"FIT","statuses":["primary"]},{"code":"FJC","name":"FJC","statuses":["primary"]},{"code":"FLO","name":"Florincoin","statuses":["primary"]},{"code":"FLOZ","name":"FLOZ","statuses":["primary"]},{"code":"FLT","name":"FlutterCoin","statuses":["primary"]},{"code":"FLX","name":"FLX","statuses":["primary"]},{"code":"FLY","name":"Flycoin","statuses":["primary"]},{"code":"FLDC","name":"FoldingCoin","statuses":["primary"]},{"code":"FONZ","name":"FONZ","statuses":["primary"]},{"code":"FRK","name":"Franko","statuses":["primary"]},{"code":"FRC","name":"Freicoin","statuses":["primary"]},{"code":"FRN","name":"FRN","statuses":["primary"]},{"code":"FRWC","name":"FRWC","statuses":["primary"]},{"code":"FSC2","name":"FSC2","statuses":["primary"]},{"code":"FST","name":"FST","statuses":["primary"]},{"code":"FTP","name":"FTP","statuses":["primary"]},{"code":"FUN","name":"FUN","statuses":["primary"]},{"code":"FUTC","name":"FUTC","statuses":["primary"]},{"code":"FUZZ","name":"FUZZ","statuses":["primary"]},{"code":"GAIA","name":"GAIA","statuses":["primary"]},{"code":"GAIN","name":"GAIN","statuses":["primary"]},{"code":"GAKH","name":"GAKH","statuses":["primary"]},{"code":"GAM","name":"GAM","statuses":["primary"]},{"code":"GBT","name":"GameBet Coin","statuses":["primary"]},{"code":"GAME","name":"GameCredits","statuses":["primary"]},{"code":"GAP","name":"Gapcoin","statuses":["primary"]},{"code":"GARY","name":"GARY","statuses":["primary"]},{"code":"GB","name":"GB","statuses":["primary"]},{"code":"GBC","name":"GBC","statuses":["primary"]},{"code":"GBIT","name":"GBIT","statuses":["primary"]},{"code":"GCC","name":"GCC","statuses":["primary"]},{"code":"GCN","name":"GCN","statuses":["primary"]},{"code":"GEO","name":"GeoCoin","statuses":["primary"]},{"code":"GEMZ","name":"GetGems","statuses":["primary"]},{"code":"GHOST","name":"GHOST","statuses":["primary"]},{"code":"GHS","name":"GHS","statuses":["primary"]},{"code":"GIFT","name":"GIFT","statuses":["primary"]},{"code":"GIG","name":"GIG","statuses":["primary"]},{"code":"GLC","name":"GLC","statuses":["primary"]},{"code":"BSTY","name":"GlobalBoost-Y","statuses":["primary"]},{"code":"GML","name":"GML","statuses":["primary"]},{"code":"GMX","name":"GMX","statuses":["primary"]},{"code":"GCR","name":"GoCoineR","statuses":["primary"]},{"code":"GLD","name":"GoldCoin","statuses":["primary"]},{"code":"GOON","name":"GOON","statuses":["primary"]},{"code":"GP","name":"GP","statuses":["primary"]},{"code":"GPU","name":"GPU","statuses":["primary"]},{"code":"GRAM","name":"GRAM","statuses":["primary"]},{"code":"GRT","name":"Grantcoin","statuses":["primary"]},{"code":"GRE","name":"GRE","statuses":["primary"]},{"code":"GRC","name":"Gridcoin","statuses":["primary"]},{"code":"GRN","name":"GRN","statuses":["primary"]},{"code":"GRS","name":"Groestlcoin","statuses":["primary"]},{"code":"GRW","name":"GRW","statuses":["primary"]},{"code":"GSM","name":"GSM","statuses":["primary"]},{"code":"GSX","name":"GSX","statuses":["primary"]},{"code":"GUA","name":"GUA","statuses":["primary"]},{"code":"NLG","name":"Gulden","statuses":["primary"]},{"code":"GUN","name":"GUN","statuses":["primary"]},{"code":"HAM","name":"HAM","statuses":["primary"]},{"code":"HAWK","name":"HAWK","statuses":["primary"]},{"code":"HCC","name":"HCC","statuses":["primary"]},{"code":"HEAT","name":"HEAT","statuses":["primary"]},{"code":"HMP","name":"HempCoin","statuses":["primary"]},{"code":"XHI","name":"HiCoin","statuses":["primary"]},{"code":"HIFUN","name":"HIFUN","statuses":["primary"]},{"code":"HILL","name":"HILL","statuses":["primary"]},{"code":"HIRE","name":"HIRE","statuses":["primary"]},{"code":"HNC","name":"HNC","statuses":["primary"]},{"code":"HODL","name":"HOdlcoin","statuses":["primary"]},{"code":"HKD","name":"Hong Kong Dollar","statuses":["secondary"]},{"code":"HZ","name":"Horizon","statuses":["primary"]},{"code":"HTC","name":"HTC","statuses":["primary"]},{"code":"HTML5","name":"HTMLCOIN","statuses":["primary"]},{"code":"HUC","name":"HUC","statuses":["primary"]},{"code":"HVCO","name":"HVCO","statuses":["primary"]},{"code":"HYPER","name":"Hyper","statuses":["primary"]},{"code":"HYP","name":"HyperStake","statuses":["primary"]},{"code":"I0C","name":"I0C","statuses":["primary"]},{"code":"IBANK","name":"IBANK","statuses":["primary"]},{"code":"ICASH","name":"iCash","statuses":["primary"]},{"code":"ICN","name":"ICN","statuses":["primary"]},{"code":"IEC","name":"IEC","statuses":["primary"]},{"code":"IFC","name":"Infinitecoin","statuses":["primary"]},{"code":"INFX","name":"Influxcoin","statuses":["primary"]},{"code":"INV","name":"INV","statuses":["primary"]},{"code":"IOC","name":"IO Coin","statuses":["primary"]},{"code":"ION","name":"ION","statuses":["primary"]},{"code":"IRL","name":"IRL","statuses":["primary"]},{"code":"ISL","name":"IslaCoin","statuses":["primary"]},{"code":"IVZ","name":"IVZ","statuses":["primary"]},{"code":"IXC","name":"IXC","statuses":["primary"]},{"code":"JIF","name":"JIF","statuses":["primary"]},{"code":"JPC","name":"JPC","statuses":["primary"]},{"code":"JPY","name":"JPY","statuses":["primary","secondary"]},{"code":"JBS","name":"Jumbucks","statuses":["primary"]},{"code":"KAT","name":"KAT","statuses":["primary"]},{"code":"KGC","name":"KGC","statuses":["primary"]},{"code":"KNC","name":"KhanCoin","statuses":["primary"]},{"code":"KLC","name":"KLC","statuses":["primary"]},{"code":"KOBO","name":"KOBO","statuses":["primary"]},{"code":"KORE","name":"KoreCoin","statuses":["primary"]},{"code":"KRAK","name":"KRAK","statuses":["primary"]},{"code":"KRYP","name":"KRYP","statuses":["primary"]},{"code":"KR","name":"Krypton","statuses":["primary"]},{"code":"KTK","name":"KTK","statuses":["primary"]},{"code":"KUBO","name":"KUBO","statuses":["primary"]},{"code":"LANA","name":"LANA","statuses":["primary"]},{"code":"LBC","name":"LBC","statuses":["primary"]},{"code":"LC","name":"LC","statuses":["primary"]},{"code":"LEA","name":"LeaCoin","statuses":["primary"]},{"code":"LEMON","name":"LEMON","statuses":["primary"]},{"code":"LEO","name":"LEO","statuses":["primary"]},{"code":"LFC","name":"LFC","statuses":["primary"]},{"code":"LFO","name":"LFO","statuses":["primary"]},{"code":"LFTC","name":"LFTC","statuses":["primary"]},{"code":"LQD","name":"LIQUID","statuses":["primary"]},{"code":"LIR","name":"LIR","statuses":["primary"]},{"code":"LSK","name":"Lisk","statuses":["primary"]},{"code":"LTC","name":"Litecoin","statuses":["primary","secondary"]},{"code":"LTCR","name":"Litecred","statuses":["primary"]},{"code":"LDOGE","name":"LiteDoge","statuses":["primary"]},{"code":"LKC","name":"LKC","statuses":["primary"]},{"code":"LOC","name":"LOC","statuses":["primary"]},{"code":"LOOT","name":"LOOT","statuses":["primary"]},{"code":"LTBC","name":"LTBcoin","statuses":["primary"]},{"code":"LTC","name":"LTC","statuses":["primary","secondary"]},{"code":"LTH","name":"LTH","statuses":["primary"]},{"code":"LTS","name":"LTS","statuses":["primary"]},{"code":"LUN","name":"LUN","statuses":["primary"]},{"code":"LXC","name":"LXC","statuses":["primary"]},{"code":"LYB","name":"LYB","statuses":["primary"]},{"code":"M1","name":"M1","statuses":["primary"]},{"code":"MAD","name":"MAD","statuses":["primary"]},{"code":"XMG","name":"Magi","statuses":["primary"]},{"code":"MAID","name":"MaidSafeCoin","statuses":["primary"]},{"code":"MXT","name":"MarteXcoin","statuses":["primary"]},{"code":"MARV","name":"MARV","statuses":["primary"]},{"code":"MARYJ","name":"MARYJ","statuses":["primary"]},{"code":"OMNI","name":"Mastercoin (Omni)","statuses":["primary"]},{"code":"MTR","name":"MasterTraderCoin","statuses":["primary"]},{"code":"MAX","name":"Maxcoin","statuses":["primary"]},{"code":"MZC","name":"Mazacoin","statuses":["primary"]},{"code":"MBL","name":"MBL","statuses":["primary"]},{"code":"MCAR","name":"MCAR","statuses":["primary"]},{"code":"MCN","name":"MCN","statuses":["primary"]},{"code":"MCZ","name":"MCZ","statuses":["primary"]},{"code":"MED","name":"MediterraneanCoin","statuses":["primary"]},{"code":"MEC","name":"Megacoin","statuses":["primary"]},{"code":"MEME","name":"Memetic","statuses":["primary"]},{"code":"METAL","name":"METAL","statuses":["primary"]},{"code":"MND","name":"MindCoin","statuses":["primary"]},{"code":"MINT","name":"Mintcoin","statuses":["primary"]},{"code":"MIS","name":"MIS","statuses":["primary"]},{"code":"MM","name":"MM","statuses":["primary"]},{"code":"MMC","name":"MMC","statuses":["primary"]},{"code":"MMNXT","name":"MMNXT","statuses":["primary"]},{"code":"MMXVI","name":"MMXVI","statuses":["primary"]},{"code":"MNM","name":"MNM","statuses":["primary"]},{"code":"MOIN","name":"MOIN","statuses":["primary"]},{"code":"MOJO","name":"MojoCoin","statuses":["primary"]},{"code":"MONA","name":"MonaCoin","statuses":["primary"]},{"code":"XMR","name":"Monero","statuses":["primary","secondary"]},{"code":"MNTA","name":"Moneta","statuses":["primary"]},{"code":"MUE","name":"MonetaryUnit","statuses":["primary"]},{"code":"MOON","name":"Mooncoin","statuses":["primary"]},{"code":"MOOND","name":"MOOND","statuses":["primary"]},{"code":"MOTO","name":"MOTO","statuses":["primary"]},{"code":"MPRO","name":"MPRO","statuses":["primary"]},{"code":"MRB","name":"MRB","statuses":["primary"]},{"code":"MRP","name":"MRP","statuses":["primary"]},{"code":"MSC","name":"MSC","statuses":["primary"]},{"code":"MYR","name":"Myriadcoin","statuses":["primary"]},{"code":"NMC","name":"Namecoin","statuses":["primary"]},{"code":"NAUT","name":"Nautiluscoin","statuses":["primary"]},{"code":"NAV","name":"NAV Coin","statuses":["primary"]},{"code":"NCS","name":"NCS","statuses":["primary"]},{"code":"XEM","name":"NEM","statuses":["primary"]},{"code":"NEOS","name":"NeosCoin","statuses":["primary"]},{"code":"NETC","name":"NETC","statuses":["primary"]},{"code":"NET","name":"NetCoin","statuses":["primary"]},{"code":"NEU","name":"NeuCoin","statuses":["primary"]},{"code":"NTRN","name":"Neutron","statuses":["primary"]},{"code":"NEVA","name":"NevaCoin","statuses":["primary"]},{"code":"NEWB","name":"NEWB","statuses":["primary"]},{"code":"NIRO","name":"Nexus","statuses":["primary"]},{"code":"NIC","name":"NIC","statuses":["primary"]},{"code":"NKA","name":"NKA","statuses":["primary"]},{"code":"NKC","name":"NKC","statuses":["primary"]},{"code":"NOBL","name":"NobleCoin","statuses":["primary"]},{"code":"NODE","name":"NODE","statuses":["primary"]},{"code":"NODES","name":"NODES","statuses":["primary"]},{"code":"NOO","name":"NOO","statuses":["primary"]},{"code":"NVC","name":"Novacoin","statuses":["primary"]},{"code":"NRC","name":"NRC","statuses":["primary"]},{"code":"NRS","name":"NRS","statuses":["primary"]},{"code":"NUBIS","name":"NUBIS","statuses":["primary"]},{"code":"NBT","name":"NuBits","statuses":["primary"]},{"code":"NUM","name":"NUM","statuses":["primary"]},{"code":"NSR","name":"NuShares","statuses":["primary"]},{"code":"NXE","name":"NXE","statuses":["primary"]},{"code":"NXT","name":"NXT","statuses":["primary"]},{"code":"NXTTY","name":"Nxttycoin","statuses":["primary"]},{"code":"NYC","name":"NYC","statuses":["primary"]},{"code":"NZC","name":"NZC","statuses":["primary"]},{"code":"NZD","name":"NZD","statuses":["primary","secondary"]},{"code":"OC","name":"OC","statuses":["primary"]},{"code":"OCOW","name":"OCOW","statuses":["primary"]},{"code":"OK","name":"OKCash","statuses":["primary"]},{"code":"OMA","name":"OMA","statuses":["primary"]},{"code":"ONE","name":"ONE","statuses":["primary"]},{"code":"ONEC","name":"ONEC","statuses":["primary"]},{"code":"OP","name":"OP","statuses":["primary"]},{"code":"OPAL","name":"OPAL","statuses":["primary"]},{"code":"OPES","name":"OPES","statuses":["primary"]},{"code":"ORB","name":"Orbitcoin","statuses":["primary"]},{"code":"ORLY","name":"Orlycoin","statuses":["primary"]},{"code":"OS76","name":"OS76","statuses":["primary"]},{"code":"OZC","name":"OZC","statuses":["primary"]},{"code":"PAC","name":"PAC","statuses":["primary"]},{"code":"PAK","name":"PAK","statuses":["primary"]},{"code":"PND","name":"Pandacoin","statuses":["primary"]},{"code":"PAPAF","name":"PAPAF","statuses":["primary"]},{"code":"XPY","name":"Paycoin","statuses":["primary"]},{"code":"PBC","name":"PBC","statuses":["primary"]},{"code":"PDC","name":"PDC","statuses":["primary"]},{"code":"XPB","name":"Pebblecoin","statuses":["primary"]},{"code":"PPC","name":"Peercoin","statuses":["primary"]},{"code":"PEN","name":"PEN","statuses":["primary"]},{"code":"PHR","name":"PHR","statuses":["primary"]},{"code":"PIGGY","name":"Piggycoin","statuses":["primary"]},{"code":"PC","name":"Pinkcoin","statuses":["primary"]},{"code":"PKB","name":"PKB","statuses":["primary"]},{"code":"PLN","name":"PLN","statuses":["primary","secondary"]},{"code":"PLNC","name":"PLNC","statuses":["primary"]},{"code":"PNC","name":"PNC","statuses":["primary"]},{"code":"PNK","name":"PNK","statuses":["primary"]},{"code":"POKE","name":"POKE","statuses":["primary"]},{"code":"PONZ2","name":"PONZ2","statuses":["primary"]},{"code":"PONZI","name":"PONZI","statuses":["primary"]},{"code":"PEX","name":"PosEx","statuses":["primary"]},{"code":"POST","name":"POST","statuses":["primary"]},{"code":"POT","name":"Potcoin","statuses":["primary"]},{"code":"PRES","name":"PRES","statuses":["primary"]},{"code":"PXI","name":"Prime-XI","statuses":["primary"]},{"code":"PRIME","name":"PrimeChain","statuses":["primary"]},{"code":"XPM","name":"Primecoin","statuses":["primary"]},{"code":"PRM","name":"PRM","statuses":["primary"]},{"code":"PRT","name":"PRT","statuses":["primary"]},{"code":"PSP","name":"PSP","statuses":["primary"]},{"code":"PTC","name":"PTC","statuses":["primary"]},{"code":"PULSE","name":"PULSE","statuses":["primary"]},{"code":"PURE","name":"PURE","statuses":["primary"]},{"code":"PUTIN","name":"PUTIN","statuses":["primary"]},{"code":"PWR","name":"PWR","statuses":["primary"]},{"code":"PXL","name":"PXL","statuses":["primary"]},{"code":"QBC","name":"QBC","statuses":["primary"]},{"code":"QBK","name":"QBK","statuses":["primary"]},{"code":"QCN","name":"QCN","statuses":["primary"]},{"code":"QORA","name":"Qora","statuses":["primary"]},{"code":"QTZ","name":"QTZ","statuses":["primary"]},{"code":"QRK","name":"Quark","statuses":["primary"]},{"code":"QTL","name":"Quatloo","statuses":["primary"]},{"code":"RADI","name":"RADI","statuses":["primary"]},{"code":"RADS","name":"Radium","statuses":["primary"]},{"code":"RED","name":"RED","statuses":["primary"]},{"code":"RDD","name":"Reddcoin","statuses":["primary"]},{"code":"REE","name":"REE","statuses":["primary"]},{"code":"REV","name":"Revenu","statuses":["primary"]},{"code":"RBR","name":"RibbitRewards","statuses":["primary"]},{"code":"RICHX","name":"RICHX","statuses":["primary"]},{"code":"RIC","name":"Riecoin","statuses":["primary"]},{"code":"RBT","name":"Rimbit","statuses":["primary"]},{"code":"RIO","name":"RIO","statuses":["primary"]},{"code":"XRP","name":"Ripple","statuses":["primary"]},{"code":"RISE","name":"RISE","statuses":["primary"]},{"code":"RMS","name":"RMS","statuses":["primary"]},{"code":"RONIN","name":"RONIN","statuses":["primary"]},{"code":"ROOT","name":"ROOT","statuses":["primary"]},{"code":"ROS","name":"RosCoin","statuses":["primary"]},{"code":"RPC","name":"RPC","statuses":["primary"]},{"code":"RBIES","name":"Rubies","statuses":["primary"]},{"code":"RUBIT","name":"RUBIT","statuses":["primary"]},{"code":"RUR","name":"Ruble","statuses":["secondary"]},{"code":"RBY","name":"Rubycoin","statuses":["primary"]},{"code":"RUST","name":"RUST","statuses":["primary"]},{"code":"SEC","name":"Safe Exchange Coin","statuses":["primary"]},{"code":"SAK","name":"SAK","statuses":["primary"]},{"code":"SAR","name":"SAR","statuses":["primary"]},{"code":"SBD","name":"SBD","statuses":["primary"]},{"code":"SBIT","name":"SBIT","statuses":["primary"]},{"code":"SCAN","name":"SCAN","statuses":["primary"]},{"code":"SCOT","name":"Scotcoin","statuses":["primary"]},{"code":"SCRPT","name":"SCRPT","statuses":["primary"]},{"code":"SCRT","name":"SCRT","statuses":["primary"]},{"code":"SRC","name":"SecureCoin","statuses":["primary"]},{"code":"SXC","name":"Sexcoin","statuses":["primary"]},{"code":"SFE","name":"SFE","statuses":["primary"]},{"code":"SFR","name":"SFR","statuses":["primary"]},{"code":"SGD","name":"SGD","statuses":["primary","secondary"]},{"code":"SDC","name":"ShadowCash","statuses":["primary"]},{"code":"SHELL","name":"SHELL","statuses":["primary"]},{"code":"SHF","name":"SHF","statuses":["primary"]},{"code":"SHI","name":"SHI","statuses":["primary"]},{"code":"SHIFT","name":"Shift","statuses":["primary"]},{"code":"SHREK","name":"SHREK","statuses":["primary"]},{"code":"SC","name":"Siacoin","statuses":["primary"]},{"code":"SIB","name":"Siberian chervonets","statuses":["primary"]},{"code":"SIC","name":"SIC","statuses":["primary"]},{"code":"SIGU","name":"SIGU","statuses":["primary"]},{"code":"SILK","name":"Silkcoin","statuses":["primary"]},{"code":"SIX","name":"SIX","statuses":["primary"]},{"code":"SLING","name":"Sling","statuses":["primary"]},{"code":"SLS","name":"SLS","statuses":["primary"]},{"code":"SMBR","name":"SMBR","statuses":["primary"]},{"code":"SMC","name":"SMC","statuses":["primary"]},{"code":"SMLY","name":"SmileyCoin","statuses":["primary"]},{"code":"SNRG","name":"SNRG","statuses":["primary"]},{"code":"SOIL","name":"SOILcoin","statuses":["primary"]},{"code":"SLR","name":"Solarcoin","statuses":["primary"]},{"code":"SOLO","name":"SOLO","statuses":["primary"]},{"code":"SONG","name":"SongCoin","statuses":["primary"]},{"code":"SOON","name":"SOON","statuses":["primary"]},{"code":"SPC","name":"SPC","statuses":["primary"]},{"code":"SPEX","name":"SPEX","statuses":["primary"]},{"code":"SPHR","name":"Sphere","statuses":["primary"]},{"code":"SPM","name":"SPM","statuses":["primary"]},{"code":"SPN","name":"SPN","statuses":["primary"]},{"code":"SPOTS","name":"SPOTS","statuses":["primary"]},{"code":"SPR","name":"SpreadCoin","statuses":["primary"]},{"code":"SPRTS","name":"Sprouts","statuses":["primary"]},{"code":"SQC","name":"SQC","statuses":["primary"]},{"code":"SSC","name":"SSC","statuses":["primary"]},{"code":"SSTC","name":"SSTC","statuses":["primary"]},{"code":"STA","name":"STA","statuses":["primary"]},{"code":"START","name":"Startcoin","statuses":["primary"]},{"code":"XST","name":"Stealthcoin","statuses":["primary"]},{"code":"STEEM","name":"Steem","statuses":["primary"]},{"code":"XLM","name":"Stellar","statuses":["primary"]},{"code":"STR","name":"Stellar","statuses":["primary"]},{"code":"STEPS","name":"Steps","statuses":["primary"]},{"code":"SLG","name":"Sterlingcoin","statuses":["primary"]},{"code":"STL","name":"STL","statuses":["primary"]},{"code":"SJCX","name":"Storjcoin X","statuses":["primary"]},{"code":"STP","name":"STP","statuses":["primary"]},{"code":"STRB","name":"STRB","statuses":["primary"]},{"code":"STS","name":"Stress","statuses":["primary"]},{"code":"STRP","name":"STRP","statuses":["primary"]},{"code":"STV","name":"STV","statuses":["primary"]},{"code":"SUB","name":"Subcriptio","statuses":["primary"]},{"code":"SUPER","name":"SUPER","statuses":["primary"]},{"code":"UNITY","name":"SuperNET","statuses":["primary"]},{"code":"SWARM","name":"Swarm","statuses":["primary"]},{"code":"SWING","name":"SWING","statuses":["primary"]},{"code":"SDP","name":"SydPak Coin","statuses":["primary"]},{"code":"SYNC","name":"SYNC","statuses":["primary"]},{"code":"AMP","name":"Synereo","statuses":["primary"]},{"code":"SYS","name":"Syscoin","statuses":["primary"]},{"code":"TAG","name":"TagCoin","statuses":["primary"]},{"code":"TAJ","name":"TAJ","statuses":["primary"]},{"code":"TAK","name":"TAK","statuses":["primary"]},{"code":"TAM","name":"TAM","statuses":["primary"]},{"code":"TAO","name":"TAO","statuses":["primary"]},{"code":"TBC","name":"TBC","statuses":["primary"]},{"code":"TBCX","name":"TBCX","statuses":["primary"]},{"code":"TCR","name":"TCR","statuses":["primary"]},{"code":"TDFB","name":"TDFB","statuses":["primary"]},{"code":"TDY","name":"TDY","statuses":["primary"]},{"code":"TEK","name":"TEKcoin","statuses":["primary"]},{"code":"TRC","name":"Terracoin","statuses":["primary"]},{"code":"TESLA","name":"TESLA","statuses":["primary"]},{"code":"TES","name":"TeslaCoin","statuses":["primary"]},{"code":"TET","name":"TET","statuses":["primary"]},{"code":"USDT","name":"Tether","statuses":["primary","secondary"]},{"code":"THC","name":"THC","statuses":["primary"]},{"code":"THS","name":"THS","statuses":["primary"]},{"code":"TIX","name":"Tickets","statuses":["primary"]},{"code":"XTC","name":"TileCoin","statuses":["primary"]},{"code":"TIT","name":"Titcoin","statuses":["primary"]},{"code":"TTC","name":"TittieCoin","statuses":["primary"]},{"code":"TMC","name":"TMC","statuses":["primary"]},{"code":"TODAY","name":"TODAY","statuses":["primary"]},{"code":"TOKEN","name":"TOKEN","statuses":["primary"]},{"code":"TP1","name":"TP1","statuses":["primary"]},{"code":"TPC","name":"TPC","statuses":["primary"]},{"code":"TPG","name":"TPG","statuses":["primary"]},{"code":"TX","name":"Transfercoin","statuses":["primary"]},{"code":"TRAP","name":"TRAP","statuses":["primary"]},{"code":"TRICK","name":"TRICK","statuses":["primary"]},{"code":"TROLL","name":"TROLL","statuses":["primary"]},{"code":"TRK","name":"Truckcoin","statuses":["primary"]},{"code":"TRUMP","name":"TrumpCoin","statuses":["primary"]},{"code":"TRUST","name":"TRUST","statuses":["primary"]},{"code":"UAE","name":"UAE","statuses":["primary"]},{"code":"UFO","name":"UFO Coin","statuses":["primary"]},{"code":"UIS","name":"UIS","statuses":["primary"]},{"code":"UTC","name":"UltraCoin","statuses":["primary"]},{"code":"UNC","name":"UNC","statuses":["primary"]},{"code":"UNIQ","name":"UNIQ","statuses":["primary"]},{"code":"UNIT","name":"Universal Currency","statuses":["primary"]},{"code":"UNO","name":"Unobtanium","statuses":["primary"]},{"code":"URO","name":"Uro","statuses":["primary"]},{"code":"USD","name":"US Dollar","statuses":["primary","secondary"]},{"code":"USDE","name":"USDE","statuses":["primary"]},{"code":"UTH","name":"UTH","statuses":["primary"]},{"code":"VAL","name":"VAL","statuses":["primary"]},{"code":"XVC","name":"Vcash","statuses":["primary"]},{"code":"VCN","name":"VCN","statuses":["primary"]},{"code":"VEG","name":"VEG","statuses":["primary"]},{"code":"VENE","name":"VENE","statuses":["primary"]},{"code":"XVG","name":"Verge","statuses":["primary"]},{"code":"VRC","name":"VeriCoin","statuses":["primary"]},{"code":"VTC","name":"Vertcoin","statuses":["primary"]},{"code":"VIA","name":"Viacoin","statuses":["primary"]},{"code":"VIOR","name":"Viorcoin","statuses":["primary"]},{"code":"VIP","name":"VIP Tokens","statuses":["primary"]},{"code":"VIRAL","name":"Viral","statuses":["primary"]},{"code":"VOOT","name":"VootCoin","statuses":["primary"]},{"code":"VOX","name":"Voxels","statuses":["primary"]},{"code":"VOYA","name":"VOYA","statuses":["primary"]},{"code":"VPN","name":"VPNCoin","statuses":["primary"]},{"code":"VPRC","name":"VPRC","statuses":["primary"]},{"code":"VTA","name":"VTA","statuses":["primary"]},{"code":"VTN","name":"VTN","statuses":["primary"]},{"code":"VTR","name":"VTR","statuses":["primary"]},{"code":"WAC","name":"WAC","statuses":["primary"]},{"code":"WARP","name":"WARP","statuses":["primary"]},{"code":"WAVES","name":"WAVES","statuses":["primary"]},{"code":"WGC","name":"WGC","statuses":["primary"]},{"code":"XWC","name":"Whitecoin","statuses":["primary"]},{"code":"WBB","name":"Wild Beast Block","statuses":["primary"]},{"code":"WLC","name":"WLC","statuses":["primary"]},{"code":"WMC","name":"WMC","statuses":["primary"]},{"code":"LOG","name":"Woodcoin","statuses":["primary"]},{"code":"WOP","name":"WOP","statuses":["primary"]},{"code":"WDC","name":"Worldcoin","statuses":["primary"]},{"code":"XAB","name":"XAB","statuses":["primary"]},{"code":"XAI","name":"XAI","statuses":["primary"]},{"code":"XAU","name":"Xaurum","statuses":["primary"]},{"code":"XBS","name":"XBS","statuses":["primary"]},{"code":"XBU","name":"XBU","statuses":["primary"]},{"code":"XCO","name":"XCO","statuses":["primary"]},{"code":"XC","name":"XCurrency","statuses":["primary"]},{"code":"XDB","name":"XDB","statuses":["primary"]},{"code":"XEMP","name":"XEMP","statuses":["primary"]},{"code":"XFC","name":"XFC","statuses":["primary"]},{"code":"MI","name":"Xiaomicoin","statuses":["primary"]},{"code":"XID","name":"XID","statuses":["primary"]},{"code":"XJO","name":"XJO","statuses":["primary"]},{"code":"XLTCG","name":"XLTCG","statuses":["primary"]},{"code":"XMS","name":"XMS","statuses":["primary"]},{"code":"XNX","name":"XNX","statuses":["primary"]},{"code":"XPD","name":"XPD","statuses":["primary"]},{"code":"XPOKE","name":"XPOKE","statuses":["primary"]},{"code":"XPRO","name":"XPRO","statuses":["primary"]},{"code":"XQN","name":"XQN","statuses":["primary"]},{"code":"XSEED","name":"XSEED","statuses":["primary"]},{"code":"XSP","name":"XSP","statuses":["primary"]},{"code":"XT","name":"XT","statuses":["primary"]},{"code":"XTP","name":"XTP","statuses":["primary"]},{"code":"XUSD","name":"XUSD","statuses":["primary"]},{"code":"YACC","name":"YACC","statuses":["primary"]},{"code":"YAC","name":"Yacoin","statuses":["primary"]},{"code":"YAY","name":"YAY","statuses":["primary"]},{"code":"YBC","name":"Ybcoin","statuses":["primary"]},{"code":"YOC","name":"YOC","statuses":["primary"]},{"code":"YOVI","name":"YOVI","statuses":["primary"]},{"code":"YUM","name":"YUM","statuses":["primary"]},{"code":"ZCC","name":"ZCC","statuses":["primary"]},{"code":"ZEIT","name":"Zeitcoin","statuses":["primary"]},{"code":"ZET","name":"Zetacoin","statuses":["primary"]},{"code":"ZRC","name":"ZiftrCOIN","statuses":["primary"]},{"code":"ZMC","name":"ZMC","statuses":["primary"]},{"code":"ZNY","name":"ZNY","statuses":["primary"]},{"code":"ZS","name":"ZS","statuses":["primary"]}]} \ No newline at end of file
diff --git a/app/manifest.json b/app/manifest.json
index a3242149b..7ae20158c 100644
--- a/app/manifest.json
+++ b/app/manifest.json
@@ -1,7 +1,7 @@
{
"name": "MetaMask",
"short_name": "Metamask",
- "version": "3.5.2",
+ "version": "3.7.8",
"manifest_version": 2,
"author": "https://metamask.io",
"description": "Ethereum Browser Extension",
@@ -58,7 +58,7 @@
"storage",
"clipboardWrite",
"http://localhost:8545/",
- "https://www.cryptonator.com/"
+ "https://api.cryptonator.com/"
],
"web_accessible_resources": [
"scripts/inpage.js"
diff --git a/app/scripts/account-import-strategies/index.js b/app/scripts/account-import-strategies/index.js
index d5124eb7f..96e2b5912 100644
--- a/app/scripts/account-import-strategies/index.js
+++ b/app/scripts/account-import-strategies/index.js
@@ -4,7 +4,7 @@ const ethUtil = require('ethereumjs-util')
const accountImporter = {
- importAccount(strategy, args) {
+ importAccount (strategy, args) {
try {
const importer = this.strategies[strategy]
const privateKeyHex = importer.apply(null, args)
diff --git a/app/scripts/background.js b/app/scripts/background.js
index 7211f1e0c..1dbfb1b98 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -1,6 +1,5 @@
const urlUtil = require('url')
const endOfStream = require('end-of-stream')
-const asyncQ = require('async-q')
const pipe = require('pump')
const LocalStorageStore = require('obs-store/lib/localStorage')
const storeTransform = require('obs-store/lib/transform')
@@ -30,38 +29,32 @@ let popupIsOpen = false
const diskStore = new LocalStorageStore({ storageKey: STORAGE_KEY })
// initialization flow
-asyncQ.waterfall([
- () => loadStateFromPersistence(),
- (initState) => setupController(initState),
-])
-.then(() => console.log('MetaMask initialization complete.'))
-.catch((err) => { console.error(err) })
+initialize().catch(console.error)
+
+async function initialize () {
+ const initState = await loadStateFromPersistence()
+ await setupController(initState)
+ console.log('MetaMask initialization complete.')
+}
//
// State and Persistence
//
-function loadStateFromPersistence() {
+async function loadStateFromPersistence () {
// migrations
- let migrator = new Migrator({ migrations })
- let initialState = migrator.generateInitialState(firstTimeState)
- return asyncQ.waterfall([
- // read from disk
- () => Promise.resolve(diskStore.getState() || initialState),
- // migrate data
- (versionedData) => migrator.migrateData(versionedData),
- // write to disk
- (versionedData) => {
- diskStore.putState(versionedData)
- return Promise.resolve(versionedData)
- },
- // resolve to just data
- (versionedData) => Promise.resolve(versionedData.data),
- ])
+ const migrator = new Migrator({ migrations })
+ // read from disk
+ let versionedData = diskStore.getState() || migrator.generateInitialState(firstTimeState)
+ // migrate data
+ versionedData = await migrator.migrateData(versionedData)
+ // write to disk
+ diskStore.putState(versionedData)
+ // return just the data
+ return versionedData.data
}
function setupController (initState) {
-
//
// MetaMask Controller
//
@@ -85,8 +78,8 @@ function setupController (initState) {
diskStore
)
- function versionifyData(state) {
- let versionedData = diskStore.getState()
+ function versionifyData (state) {
+ const versionedData = diskStore.getState()
versionedData.data = state
return versionedData
}
@@ -121,13 +114,13 @@ function setupController (initState) {
//
updateBadge()
- controller.txManager.on('updateBadge', updateBadge)
+ controller.txController.on('updateBadge', updateBadge)
controller.messageManager.on('updateBadge', updateBadge)
// plugin badge text
function updateBadge () {
var label = ''
- var unapprovedTxCount = controller.txManager.unapprovedTxCount
+ var unapprovedTxCount = controller.txController.unapprovedTxCount
var unapprovedMsgCount = controller.messageManager.unapprovedMsgCount
var count = unapprovedTxCount + unapprovedMsgCount
if (count) {
@@ -138,7 +131,6 @@ function setupController (initState) {
}
return Promise.resolve()
-
}
//
diff --git a/app/scripts/config.js b/app/scripts/config.js
index ec421744d..8e28db80e 100644
--- a/app/scripts/config.js
+++ b/app/scripts/config.js
@@ -1,16 +1,15 @@
const MAINET_RPC_URL = 'https://mainnet.infura.io/metamask'
-const TESTNET_RPC_URL = 'https://ropsten.infura.io/metamask'
+const ROPSTEN_RPC_URL = 'https://ropsten.infura.io/metamask'
const KOVAN_RPC_URL = 'https://kovan.infura.io/metamask'
-const DEFAULT_RPC_URL = TESTNET_RPC_URL
+const RINKEBY_RPC_URL = 'https://rinkeby.infura.io/metamask'
global.METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
module.exports = {
network: {
- default: DEFAULT_RPC_URL,
mainnet: MAINET_RPC_URL,
- testnet: TESTNET_RPC_URL,
- morden: TESTNET_RPC_URL,
+ ropsten: ROPSTEN_RPC_URL,
kovan: KOVAN_RPC_URL,
+ rinkeby: RINKEBY_RPC_URL,
},
}
diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js
index 4d7e682d3..291b922e8 100644
--- a/app/scripts/contentscript.js
+++ b/app/scripts/contentscript.js
@@ -61,7 +61,6 @@ function setupStreams () {
// ignore unused channels (handled by background)
mx.ignoreStream('provider')
mx.ignoreStream('publicConfig')
- mx.ignoreStream('reload')
}
function shouldInjectWeb3 () {
@@ -77,7 +76,7 @@ function doctypeCheck () {
}
}
-function suffixCheck() {
+function suffixCheck () {
var prohibitedTypes = ['xml', 'pdf']
var currentUrl = window.location.href
var currentRegex
diff --git a/app/scripts/controllers/address-book.js b/app/scripts/controllers/address-book.js
index c66eb2bd4..6fb4ee114 100644
--- a/app/scripts/controllers/address-book.js
+++ b/app/scripts/controllers/address-book.js
@@ -39,11 +39,11 @@ class AddressBookController {
// pushed object is an object of two fields. Current behavior does not set an
// upper limit to the number of addresses.
_addToAddressBook (address, name) {
- let addressBook = this._getAddressBook()
- let identities = this._getIdentities()
+ const addressBook = this._getAddressBook()
+ const identities = this._getIdentities()
- let addressBookIndex = addressBook.findIndex((element) => { return element.address.toLowerCase() === address.toLowerCase() || element.name === name })
- let identitiesIndex = Object.keys(identities).findIndex((element) => { return element.toLowerCase() === address.toLowerCase() })
+ const addressBookIndex = addressBook.findIndex((element) => { return element.address.toLowerCase() === address.toLowerCase() || element.name === name })
+ const identitiesIndex = Object.keys(identities).findIndex((element) => { return element.toLowerCase() === address.toLowerCase() })
// trigger this condition if we own this address--no need to overwrite.
if (identitiesIndex !== -1) {
return Promise.resolve(addressBook)
diff --git a/app/scripts/controllers/currency.js b/app/scripts/controllers/currency.js
index c4904f8ac..1f20dc005 100644
--- a/app/scripts/controllers/currency.js
+++ b/app/scripts/controllers/currency.js
@@ -45,15 +45,17 @@ class CurrencyController {
updateConversionRate () {
const currentCurrency = this.getCurrentCurrency()
- return fetch(`https://www.cryptonator.com/api/ticker/eth-${currentCurrency}`)
+ return fetch(`https://api.cryptonator.com/api/ticker/eth-${currentCurrency}`)
.then(response => response.json())
.then((parsedResponse) => {
this.setConversionRate(Number(parsedResponse.ticker.price))
this.setConversionDate(Number(parsedResponse.timestamp))
}).catch((err) => {
- console.warn('MetaMask - Failed to query currency conversion.')
- this.setConversionRate(0)
- this.setConversionDate('N/A')
+ if (err) {
+ console.warn('MetaMask - Failed to query currency conversion.')
+ this.setConversionRate(0)
+ this.setConversionDate('N/A')
+ }
})
}
diff --git a/app/scripts/controllers/network.js b/app/scripts/controllers/network.js
new file mode 100644
index 000000000..c07f13b8d
--- /dev/null
+++ b/app/scripts/controllers/network.js
@@ -0,0 +1,129 @@
+const EventEmitter = require('events')
+const MetaMaskProvider = require('web3-provider-engine/zero.js')
+const ObservableStore = require('obs-store')
+const ComposedStore = require('obs-store/lib/composed')
+const extend = require('xtend')
+const EthQuery = require('eth-query')
+const RPC_ADDRESS_LIST = require('../config.js').network
+const DEFAULT_RPC = RPC_ADDRESS_LIST['rinkeby']
+
+module.exports = class NetworkController extends EventEmitter {
+ constructor (config) {
+ super()
+ this.networkStore = new ObservableStore('loading')
+ config.provider.rpcTarget = this.getRpcAddressForType(config.provider.type, config.provider)
+ this.providerStore = new ObservableStore(config.provider)
+ this.store = new ComposedStore({ provider: this.providerStore, network: this.networkStore })
+ this._providerListeners = {}
+
+ this.on('networkDidChange', this.lookupNetwork)
+ this.providerStore.subscribe((state) => this.switchNetwork({rpcUrl: state.rpcTarget}))
+ }
+
+ get provider () {
+ return this._proxy
+ }
+
+ set provider (provider) {
+ this._provider = provider
+ }
+
+ initializeProvider (opts) {
+ this.providerInit = opts
+ this._provider = MetaMaskProvider(opts)
+ this._proxy = new Proxy(this._provider, {
+ get: (obj, name) => {
+ if (name === 'on') return this._on.bind(this)
+ return this._provider[name]
+ },
+ set: (obj, name, value) => {
+ this._provider[name] = value
+ },
+ })
+ this.provider.on('block', this._logBlock.bind(this))
+ this.provider.on('error', this.verifyNetwork.bind(this))
+ this.ethQuery = new EthQuery(this.provider)
+ this.lookupNetwork()
+ return this.provider
+ }
+
+ switchNetwork (providerInit) {
+ this.setNetworkState('loading')
+ const newInit = extend(this.providerInit, providerInit)
+ this.providerInit = newInit
+
+ this._provider.removeAllListeners()
+ this._provider.stop()
+ this.provider = MetaMaskProvider(newInit)
+ // apply the listners created by other controllers
+ Object.keys(this._providerListeners).forEach((key) => {
+ this._providerListeners[key].forEach((handler) => this._provider.addListener(key, handler))
+ })
+ this.emit('networkDidChange')
+ }
+
+
+ verifyNetwork () {
+ // Check network when restoring connectivity:
+ if (this.isNetworkLoading()) this.lookupNetwork()
+ }
+
+ getNetworkState () {
+ return this.networkStore.getState()
+ }
+
+ setNetworkState (network) {
+ return this.networkStore.putState(network)
+ }
+
+ isNetworkLoading () {
+ return this.getNetworkState() === 'loading'
+ }
+
+ lookupNetwork () {
+ this.ethQuery.sendAsync({ method: 'net_version' }, (err, network) => {
+ if (err) return this.setNetworkState('loading')
+ log.info('web3.getNetwork returned ' + network)
+ this.setNetworkState(network)
+ })
+ }
+
+ setRpcTarget (rpcUrl) {
+ this.providerStore.updateState({
+ type: 'rpc',
+ rpcTarget: rpcUrl,
+ })
+ }
+
+ getCurrentRpcAddress () {
+ const provider = this.getProviderConfig()
+ if (!provider) return null
+ return this.getRpcAddressForType(provider.type)
+ }
+
+ setProviderType (type) {
+ if (type === this.getProviderConfig().type) return
+ const rpcTarget = this.getRpcAddressForType(type)
+ this.providerStore.updateState({type, rpcTarget})
+ }
+
+ getProviderConfig () {
+ return this.providerStore.getState()
+ }
+
+ getRpcAddressForType (type, provider = this.getProviderConfig()) {
+ if (RPC_ADDRESS_LIST[type]) return RPC_ADDRESS_LIST[type]
+ return provider && provider.rpcTarget ? provider.rpcTarget : DEFAULT_RPC
+ }
+
+ _logBlock (block) {
+ log.info(`BLOCK CHANGED: #${block.number.toString('hex')} 0x${block.hash.toString('hex')}`)
+ this.verifyNetwork()
+ }
+
+ _on (event, handler) {
+ if (!this._providerListeners[event]) this._providerListeners[event] = []
+ this._providerListeners[event].push(handler)
+ this._provider.on(event, handler)
+ }
+}
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js
index c7f675a41..7212c7c43 100644
--- a/app/scripts/controllers/preferences.js
+++ b/app/scripts/controllers/preferences.js
@@ -36,8 +36,8 @@ class PreferencesController {
}
addToFrequentRpcList (_url) {
- let rpcList = this.getFrequentRpcList()
- let index = rpcList.findIndex((element) => { return element === _url })
+ const rpcList = this.getFrequentRpcList()
+ const index = rpcList.findIndex((element) => { return element === _url })
if (index !== -1) {
rpcList.splice(index, 1)
}
@@ -53,13 +53,9 @@ class PreferencesController {
getFrequentRpcList () {
return this.store.getState().frequentRpcList
}
-
//
// PRIVATE METHODS
//
-
-
-
}
module.exports = PreferencesController
diff --git a/app/scripts/transaction-manager.js b/app/scripts/controllers/transactions.js
index 22d807748..8be73fad8 100644
--- a/app/scripts/transaction-manager.js
+++ b/app/scripts/controllers/transactions.js
@@ -4,11 +4,14 @@ const extend = require('xtend')
const Semaphore = require('semaphore')
const ObservableStore = require('obs-store')
const ethUtil = require('ethereumjs-util')
-const EthQuery = require('eth-query')
-const TxProviderUtil = require('./lib/tx-utils')
-const createId = require('./lib/random-id')
+const TxProviderUtil = require('../lib/tx-utils')
+const createId = require('../lib/random-id')
+const denodeify = require('denodeify')
-module.exports = class TransactionManager extends EventEmitter {
+const RETRY_LIMIT = 200
+const RESUBMIT_INTERVAL = 10000 // Ten seconds
+
+module.exports = class TransactionController extends EventEmitter {
constructor (opts) {
super()
this.store = new ObservableStore(extend({
@@ -20,17 +23,19 @@ module.exports = class TransactionManager extends EventEmitter {
this.txHistoryLimit = opts.txHistoryLimit
this.provider = opts.provider
this.blockTracker = opts.blockTracker
- this.query = new EthQuery(this.provider)
- this.txProviderUtils = new TxProviderUtil(this.provider)
+ this.query = opts.ethQuery
+ this.txProviderUtils = new TxProviderUtil(this.query)
this.blockTracker.on('block', this.checkForTxInBlock.bind(this))
this.signEthTx = opts.signTransaction
this.nonceLock = Semaphore(1)
// memstore is computed from a few different stores
this._updateMemstore()
- this.store.subscribe(() => this._updateMemstore() )
- this.networkStore.subscribe(() => this._updateMemstore() )
- this.preferencesStore.subscribe(() => this._updateMemstore() )
+ this.store.subscribe(() => this._updateMemstore())
+ this.networkStore.subscribe(() => this._updateMemstore())
+ this.preferencesStore.subscribe(() => this._updateMemstore())
+
+ this.continuallyResubmitPendingTxs()
}
getState () {
@@ -38,7 +43,7 @@ module.exports = class TransactionManager extends EventEmitter {
}
getNetwork () {
- return this.networkStore.getState().network
+ return this.networkStore.getState()
}
getSelectedAddress () {
@@ -47,8 +52,8 @@ module.exports = class TransactionManager extends EventEmitter {
// Returns the tx list
getTxList () {
- let network = this.getNetwork()
- let fullTxList = this.getFullTxList()
+ const network = this.getNetwork()
+ const fullTxList = this.getFullTxList()
return fullTxList.filter(txMeta => txMeta.metamaskNetworkId === network)
}
@@ -64,10 +69,10 @@ module.exports = class TransactionManager extends EventEmitter {
// Adds a tx to the txlist
addTx (txMeta) {
- let txCount = this.getTxCount()
- let network = this.getNetwork()
- let fullTxList = this.getFullTxList()
- let txHistoryLimit = this.txHistoryLimit
+ const txCount = this.getTxCount()
+ const network = this.getNetwork()
+ const fullTxList = this.getFullTxList()
+ const txHistoryLimit = this.txHistoryLimit
// checks if the length of the tx history is
// longer then desired persistence limit
@@ -197,7 +202,7 @@ module.exports = class TransactionManager extends EventEmitter {
}
fillInTxParams (txId, cb) {
- let txMeta = this.getTx(txId)
+ const txMeta = this.getTx(txId)
this.txProviderUtils.fillInTxParams(txMeta.txParams, (err) => {
if (err) return cb(err)
this.updateTx(txMeta)
@@ -205,7 +210,7 @@ module.exports = class TransactionManager extends EventEmitter {
})
}
- getChainId() {
+ getChainId () {
const networkState = this.networkStore.getState()
const getChainId = parseInt(networkState.network)
if (Number.isNaN(getChainId)) {
@@ -230,7 +235,11 @@ module.exports = class TransactionManager extends EventEmitter {
})
}
- publishTransaction (txId, rawTx, cb) {
+ publishTransaction (txId, rawTx, cb = warn) {
+ const txMeta = this.getTx(txId)
+ txMeta.rawTx = rawTx
+ this.updateTx(txMeta)
+
this.txProviderUtils.publishTransaction(rawTx, (err, txHash) => {
if (err) return cb(err)
this.setTxHash(txId, txHash)
@@ -242,7 +251,7 @@ module.exports = class TransactionManager extends EventEmitter {
// receives a txHash records the tx as signed
setTxHash (txId, txHash) {
// Add the tx hash to the persisted meta-tx object
- let txMeta = this.getTx(txId)
+ const txMeta = this.getTx(txId)
txMeta.hash = txHash
this.updateTx(txMeta)
}
@@ -315,7 +324,7 @@ module.exports = class TransactionManager extends EventEmitter {
}
setTxStatusFailed (txId, reason) {
- let txMeta = this.getTx(txId)
+ const txMeta = this.getTx(txId)
txMeta.err = reason
this.updateTx(txMeta)
this._setTxStatus(txId, 'failed')
@@ -338,7 +347,7 @@ module.exports = class TransactionManager extends EventEmitter {
var txHash = txMeta.hash
var txId = txMeta.id
if (!txHash) {
- let errReason = {
+ const errReason = {
errCode: 'No hash was provided',
message: 'We had an error while submitting this transaction, please try again.',
}
@@ -353,7 +362,7 @@ module.exports = class TransactionManager extends EventEmitter {
message: 'There was a problem loading this transaction.',
}
this.updateTx(txMeta)
- return console.error(err)
+ return log.error(err)
}
if (txParams.blockNumber) {
this.setTxStatusConfirmed(txId)
@@ -380,6 +389,7 @@ module.exports = class TransactionManager extends EventEmitter {
this.emit(`${txMeta.id}:${status}`, txId)
if (status === 'submitted' || status === 'rejected') {
this.emit(`${txMeta.id}:finished`, txMeta)
+
}
this.updateTx(txMeta)
this.emit('updateBadge')
@@ -399,7 +409,47 @@ module.exports = class TransactionManager extends EventEmitter {
})
this.memStore.updateState({ unapprovedTxs, selectedAddressTxList })
}
+
+ continuallyResubmitPendingTxs () {
+ const pending = this.getTxsByMetaData('status', 'submitted')
+ const resubmit = denodeify(this.resubmitTx.bind(this))
+ Promise.all(pending.map(txMeta => resubmit(txMeta)))
+ .catch((reason) => {
+ log.info('Problem resubmitting tx', reason)
+ })
+ .then(() => {
+ global.setTimeout(() => {
+ this.continuallyResubmitPendingTxs()
+ }, RESUBMIT_INTERVAL)
+ })
+ }
+
+ resubmitTx (txMeta, cb) {
+ // Increment a try counter.
+ if (!('retryCount' in txMeta)) {
+ txMeta.retryCount = 0
+ }
+
+ // Only auto-submit already-signed txs:
+ if (!('rawTx' in txMeta)) {
+ return cb()
+ }
+
+ if (txMeta.retryCount > RETRY_LIMIT) {
+ txMeta.err = {
+ isWarning: true,
+ message: 'Gave up submitting tx.',
+ }
+ this.updateTx(txMeta)
+ return log.error(txMeta.err.message)
+ }
+
+ txMeta.retryCount++
+ const rawTx = txMeta.rawTx
+ this.txProviderUtils.publishTransaction(rawTx, cb)
+ }
+
}
-const warn = () => console.warn('warn was used no cb provided')
+const warn = () => log.warn('warn was used no cb provided')
diff --git a/app/scripts/first-time-state.js b/app/scripts/first-time-state.js
index 3196981ba..5e8577100 100644
--- a/app/scripts/first-time-state.js
+++ b/app/scripts/first-time-state.js
@@ -1,11 +1,15 @@
+// test and development environment variables
+const env = process.env.METAMASK_ENV
+const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
+
//
// The default state of MetaMask
//
-
module.exports = {
- config: {
+ config: {},
+ NetworkController: {
provider: {
- type: 'testnet',
+ type: (METAMASK_DEBUG || env === 'test') ? 'rinkeby' : 'mainnet',
},
},
-} \ No newline at end of file
+}
diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js
index 419f78cd6..ec764535e 100644
--- a/app/scripts/inpage.js
+++ b/app/scripts/inpage.js
@@ -31,26 +31,11 @@ web3.setProvider = function () {
console.log('MetaMask - overrode web3.setProvider')
}
console.log('MetaMask - injected web3')
-// export global web3, with usage-detection reload fn
-var triggerReload = setupDappAutoReload(web3)
-
-// listen for reset requests from metamask
-var reloadStream = inpageProvider.multiStream.createStream('reload')
-reloadStream.once('data', triggerReload)
-
-// setup ping timeout autoreload
-// LocalMessageDuplexStream does not self-close, so reload if pingStream fails
-// var pingChannel = inpageProvider.multiStream.createStream('pingpong')
-// var pingStream = new PingStream({ objectMode: true })
-// wait for first successful reponse
-
-// disable pingStream until https://github.com/MetaMask/metamask-plugin/issues/746 is resolved more gracefully
-// metamaskStream.once('data', function(){
-// pingStream.pipe(pingChannel).pipe(pingStream)
-// })
-// endOfStream(pingStream, triggerReload)
+// export global web3, with usage-detection
+setupDappAutoReload(web3, inpageProvider.publicConfigStore)
// set web3 defaultAccount
+
inpageProvider.publicConfigStore.subscribe(function (state) {
web3.eth.defaultAccount = state.selectedAddress
})
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js
index 16df6efa6..5b3c80e40 100644
--- a/app/scripts/keyring-controller.js
+++ b/app/scripts/keyring-controller.js
@@ -187,7 +187,7 @@ class KeyringController extends EventEmitter {
.then((accounts) => {
switch (type) {
case 'Simple Key Pair':
- let isNotIncluded = !accounts.find((key) => key === newAccount[0] || key === ethUtil.stripHexPrefix(newAccount[0]))
+ const isNotIncluded = !accounts.find((key) => key === newAccount[0] || key === ethUtil.stripHexPrefix(newAccount[0]))
return (isNotIncluded) ? Promise.resolve(newAccount) : Promise.reject(new Error('The account you\'re are trying to import is a duplicate'))
default:
return Promise.resolve(newAccount)
@@ -582,7 +582,7 @@ class KeyringController extends EventEmitter {
})
}
- _updateMemStoreKeyrings() {
+ _updateMemStoreKeyrings () {
Promise.all(this.keyrings.map(this.displayForKeyring))
.then((keyrings) => {
this.memStore.updateState({ keyrings })
diff --git a/app/scripts/lib/auto-reload.js b/app/scripts/lib/auto-reload.js
index 1302df35f..534047330 100644
--- a/app/scripts/lib/auto-reload.js
+++ b/app/scripts/lib/auto-reload.js
@@ -1,30 +1,33 @@
-const once = require('once')
-const ensnare = require('ensnare')
-
module.exports = setupDappAutoReload
-function setupDappAutoReload (web3) {
+function setupDappAutoReload (web3, observable) {
// export web3 as a global, checking for usage
- var pageIsUsingWeb3 = false
- var resetWasRequested = false
- global.web3 = ensnare(web3, once(function () {
- // if web3 usage happened after a reset request, trigger reset late
- if (resetWasRequested) return triggerReset()
- // mark web3 as used
- pageIsUsingWeb3 = true
- // reset web3 reference
- global.web3 = web3
- }))
+ global.web3 = new Proxy(web3, {
+ get: (_web3, name) => {
+ // get the time of use
+ if (name !== '_used') _web3._used = Date.now()
+ return _web3[name]
+ },
+ set: (_web3, name, value) => {
+ _web3[name] = value
+ },
+ })
+ var networkVersion
- return handleResetRequest
+ observable.subscribe(function (state) {
+ // get the initial network
+ const curentNetVersion = state.networkVersion
+ if (!networkVersion) networkVersion = curentNetVersion
- function handleResetRequest () {
- resetWasRequested = true
- // ignore if web3 was not used
- if (!pageIsUsingWeb3) return
- // reload after short timeout
- setTimeout(triggerReset, 500)
- }
+ if (curentNetVersion !== networkVersion && web3._used) {
+ const timeSinceUse = Date.now() - web3._used
+ // if web3 was recently used then delay the reloading of the page
+ timeSinceUse > 500 ? triggerReset() : setTimeout(triggerReset, 500)
+ // prevent reentry into if statement if state updates again before
+ // reload
+ networkVersion = curentNetVersion
+ }
+ })
}
// reload the page
diff --git a/app/scripts/lib/buy-eth-url.js b/app/scripts/lib/buy-eth-url.js
index 91a1ec322..b9dde3c28 100644
--- a/app/scripts/lib/buy-eth-url.js
+++ b/app/scripts/lib/buy-eth-url.js
@@ -1,6 +1,6 @@
module.exports = getBuyEthUrl
-function getBuyEthUrl({ network, amount, address }){
+function getBuyEthUrl ({ network, amount, address }) {
let url
switch (network) {
case '1':
@@ -11,9 +11,13 @@ function getBuyEthUrl({ network, amount, address }){
url = 'https://faucet.metamask.io/'
break
+ case '4':
+ url = 'https://www.rinkeby.io/'
+ break
+
case '42':
url = 'https://github.com/kovan-testnet/faucet'
break
}
return url
-} \ No newline at end of file
+}
diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js
index e31cb45ed..9c0dffe9c 100644
--- a/app/scripts/lib/config-manager.js
+++ b/app/scripts/lib/config-manager.js
@@ -1,11 +1,12 @@
-const MetamaskConfig = require('../config.js')
const ethUtil = require('ethereumjs-util')
const normalize = require('eth-sig-util').normalize
+const MetamaskConfig = require('../config.js')
+
-const TESTNET_RPC = MetamaskConfig.network.testnet
const MAINNET_RPC = MetamaskConfig.network.mainnet
-const MORDEN_RPC = MetamaskConfig.network.morden
+const ROPSTEN_RPC = MetamaskConfig.network.ropsten
const KOVAN_RPC = MetamaskConfig.network.kovan
+const RINKEBY_RPC = MetamaskConfig.network.rinkeby
/* The config-manager is a convenience object
* wrapping a pojo-migrator.
@@ -33,36 +34,6 @@ ConfigManager.prototype.getConfig = function () {
return data.config
}
-ConfigManager.prototype.setRpcTarget = function (rpcUrl) {
- var config = this.getConfig()
- config.provider = {
- type: 'rpc',
- rpcTarget: rpcUrl,
- }
- this.setConfig(config)
-}
-
-ConfigManager.prototype.setProviderType = function (type) {
- var config = this.getConfig()
- config.provider = {
- type: type,
- }
- this.setConfig(config)
-}
-
-ConfigManager.prototype.useEtherscanProvider = function () {
- var config = this.getConfig()
- config.provider = {
- type: 'etherscan',
- }
- this.setConfig(config)
-}
-
-ConfigManager.prototype.getProvider = function () {
- var config = this.getConfig()
- return config.provider
-}
-
ConfigManager.prototype.setData = function (data) {
this.store.putState(data)
}
@@ -136,6 +107,35 @@ ConfigManager.prototype.getSeedWords = function () {
var data = this.getData()
return data.seedWords
}
+ConfigManager.prototype.setRpcTarget = function (rpcUrl) {
+ var config = this.getConfig()
+ config.provider = {
+ type: 'rpc',
+ rpcTarget: rpcUrl,
+ }
+ this.setConfig(config)
+}
+
+ConfigManager.prototype.setProviderType = function (type) {
+ var config = this.getConfig()
+ config.provider = {
+ type: type,
+ }
+ this.setConfig(config)
+}
+
+ConfigManager.prototype.useEtherscanProvider = function () {
+ var config = this.getConfig()
+ config.provider = {
+ type: 'etherscan',
+ }
+ this.setConfig(config)
+}
+
+ConfigManager.prototype.getProvider = function () {
+ var config = this.getConfig()
+ return config.provider
+}
ConfigManager.prototype.getCurrentRpcAddress = function () {
var provider = this.getProvider()
@@ -145,17 +145,17 @@ ConfigManager.prototype.getCurrentRpcAddress = function () {
case 'mainnet':
return MAINNET_RPC
- case 'testnet':
- return TESTNET_RPC
-
- case 'morden':
- return MORDEN_RPC
+ case 'ropsten':
+ return ROPSTEN_RPC
case 'kovan':
return KOVAN_RPC
+ case 'rinkeby':
+ return RINKEBY_RPC
+
default:
- return provider && provider.rpcTarget ? provider.rpcTarget : TESTNET_RPC
+ return provider && provider.rpcTarget ? provider.rpcTarget : RINKEBY_RPC
}
}
diff --git a/app/scripts/lib/eth-store.js b/app/scripts/lib/eth-store.js
index 243253df2..ebba98f5c 100644
--- a/app/scripts/lib/eth-store.js
+++ b/app/scripts/lib/eth-store.js
@@ -10,7 +10,7 @@
const async = require('async')
const EthQuery = require('eth-query')
const ObservableStore = require('obs-store')
-function noop() {}
+function noop () {}
class EthereumStore extends ObservableStore {
@@ -21,6 +21,7 @@ class EthereumStore extends ObservableStore {
transactions: {},
currentBlockNumber: '0',
currentBlockHash: '',
+ currentBlockGasLimit: '',
})
this._provider = opts.provider
this._query = new EthQuery(this._provider)
@@ -73,6 +74,7 @@ class EthereumStore extends ObservableStore {
this._currentBlockNumber = blockNumber
this.updateState({ currentBlockNumber: parseInt(blockNumber) })
this.updateState({ currentBlockHash: `0x${block.hash.toString('hex')}`})
+ this.updateState({ currentBlockGasLimit: `0x${block.gasLimit.toString('hex')}` })
async.parallel([
this._updateAccounts.bind(this),
this._updateTransactions.bind(this, blockNumber),
diff --git a/app/scripts/lib/inpage-provider.js b/app/scripts/lib/inpage-provider.js
index 92936de2f..8b8623974 100644
--- a/app/scripts/lib/inpage-provider.js
+++ b/app/scripts/lib/inpage-provider.js
@@ -34,6 +34,7 @@ function MetamaskInpageProvider (connectionStream) {
asyncProvider,
(err) => logStreamDisconnectWarning('MetaMask RpcProvider', err)
)
+ // start and stop polling to unblock first block lock
self.idMap = {}
// handle sendAsync requests via asyncProvider
@@ -85,7 +86,7 @@ MetamaskInpageProvider.prototype.send = function (payload) {
break
case 'net_version':
- let networkVersion = self.publicConfigStore.getState().networkVersion
+ const networkVersion = self.publicConfigStore.getState().networkVersion
result = networkVersion
break
@@ -125,7 +126,7 @@ function eachJsonMessage (payload, transformFn) {
}
}
-function logStreamDisconnectWarning(remoteLabel, err){
+function logStreamDisconnectWarning (remoteLabel, err) {
let warningMsg = `MetamaskInpageProvider - lost connection to ${remoteLabel}`
if (err) warningMsg += '\n' + err.stack
console.warn(warningMsg)
diff --git a/app/scripts/lib/message-manager.js b/app/scripts/lib/message-manager.js
index 711d5f159..f52e048e0 100644
--- a/app/scripts/lib/message-manager.js
+++ b/app/scripts/lib/message-manager.js
@@ -4,7 +4,7 @@ const ethUtil = require('ethereumjs-util')
const createId = require('./random-id')
-module.exports = class MessageManager extends EventEmitter{
+module.exports = class MessageManager extends EventEmitter {
constructor (opts) {
super()
this.memStore = new ObservableStore({
@@ -108,7 +108,7 @@ module.exports = class MessageManager extends EventEmitter{
}
-function normalizeMsgData(data) {
+function normalizeMsgData (data) {
if (data.slice(0, 2) === '0x') {
// data is already hex
return data
diff --git a/app/scripts/lib/migrator/index.js b/app/scripts/lib/migrator/index.js
index 312345263..4fd2cae92 100644
--- a/app/scripts/lib/migrator/index.js
+++ b/app/scripts/lib/migrator/index.js
@@ -1,42 +1,35 @@
-const asyncQ = require('async-q')
-
class Migrator {
constructor (opts = {}) {
- let migrations = opts.migrations || []
+ const migrations = opts.migrations || []
+ // sort migrations by version
this.migrations = migrations.sort((a, b) => a.version - b.version)
- let lastMigration = this.migrations.slice(-1)[0]
+ // grab migration with highest version
+ const lastMigration = this.migrations.slice(-1)[0]
// use specified defaultVersion or highest migration version
this.defaultVersion = opts.defaultVersion || (lastMigration && lastMigration.version) || 0
}
// run all pending migrations on meta in place
- migrateData (versionedData = this.generateInitialState()) {
- let remaining = this.migrations.filter(migrationIsPending)
-
- return (
- asyncQ.eachSeries(remaining, (migration) => this.runMigration(versionedData, migration))
- .then(() => versionedData)
- )
-
- // migration is "pending" if hit has a higher
+ async migrateData (versionedData = this.generateInitialState()) {
+ const pendingMigrations = this.migrations.filter(migrationIsPending)
+
+ for (const index in pendingMigrations) {
+ const migration = pendingMigrations[index]
+ versionedData = await migration.migrate(versionedData)
+ if (!versionedData.data) throw new Error('Migrator - migration returned empty data')
+ if (versionedData.version !== undefined && versionedData.meta.version !== migration.version) throw new Error('Migrator - Migration did not update version number correctly')
+ }
+
+ return versionedData
+
+ // migration is "pending" if it has a higher
// version number than currentVersion
- function migrationIsPending(migration) {
+ function migrationIsPending (migration) {
return migration.version > versionedData.meta.version
}
}
- runMigration(versionedData, migration) {
- return (
- migration.migrate(versionedData)
- .then((versionedData) => {
- if (!versionedData.data) return Promise.reject(new Error('Migrator - Migration returned empty data'))
- if (migration.version !== undefined && versionedData.meta.version !== migration.version) return Promise.reject(new Error('Migrator - Migration did not update version number correctly'))
- return Promise.resolve(versionedData)
- })
- )
- }
-
generateInitialState (initState) {
return {
meta: {
diff --git a/app/scripts/lib/notification-manager.js b/app/scripts/lib/notification-manager.js
index 55e5b8dd2..7846ef7f0 100644
--- a/app/scripts/lib/notification-manager.js
+++ b/app/scripts/lib/notification-manager.js
@@ -24,9 +24,6 @@ class NotificationManager {
width,
height,
})
- .catch((reason) => {
- log.error('failed to create poupup', reason)
- })
}
})
}
@@ -71,4 +68,4 @@ class NotificationManager {
}
-module.exports = NotificationManager \ No newline at end of file
+module.exports = NotificationManager
diff --git a/app/scripts/lib/personal-message-manager.js b/app/scripts/lib/personal-message-manager.js
index bbc978446..6602f5aa8 100644
--- a/app/scripts/lib/personal-message-manager.js
+++ b/app/scripts/lib/personal-message-manager.js
@@ -5,7 +5,7 @@ const createId = require('./random-id')
const hexRe = /^[0-9A-Fa-f]+$/g
-module.exports = class PersonalMessageManager extends EventEmitter{
+module.exports = class PersonalMessageManager extends EventEmitter {
constructor (opts) {
super()
this.memStore = new ObservableStore({
@@ -108,7 +108,7 @@ module.exports = class PersonalMessageManager extends EventEmitter{
this.emit('updateBadge')
}
- normalizeMsgData(data) {
+ normalizeMsgData (data) {
try {
const stripped = ethUtil.stripHexPrefix(data)
if (stripped.match(hexRe)) {
diff --git a/app/scripts/lib/tx-utils.js b/app/scripts/lib/tx-utils.js
index e8e23f8b5..149d93102 100644
--- a/app/scripts/lib/tx-utils.js
+++ b/app/scripts/lib/tx-utils.js
@@ -1,5 +1,4 @@
const async = require('async')
-const EthQuery = require('eth-query')
const ethUtil = require('ethereumjs-util')
const Transaction = require('ethereumjs-tx')
const normalize = require('eth-sig-util').normalize
@@ -7,15 +6,14 @@ const BN = ethUtil.BN
/*
tx-utils are utility methods for Transaction manager
-its passed a provider and that is passed to ethquery
+its passed ethquery
and used to do things like calculate gas of a tx.
*/
module.exports = class txProviderUtils {
- constructor (provider) {
- this.provider = provider
- this.query = new EthQuery(provider)
+ constructor (ethQuery) {
+ this.query = ethQuery
}
analyzeGasUsage (txMeta, cb) {
@@ -35,7 +33,9 @@ module.exports = class txProviderUtils {
txMeta.gasLimitSpecified = Boolean(txParams.gas)
// if not, fallback to block gasLimit
if (!txMeta.gasLimitSpecified) {
- txParams.gas = blockGasLimitHex
+ const blockGasLimitBN = hexToBn(blockGasLimitHex)
+ const saferGasLimitBN = BnMultiplyByFraction(blockGasLimitBN, 19, 20)
+ txParams.gas = bnToHex(saferGasLimitBN)
}
// run tx, see if it will OOG
this.query.estimateGas(txParams, cb)
@@ -75,14 +75,14 @@ module.exports = class txProviderUtils {
}
fillInTxParams (txParams, cb) {
- let fromAddress = txParams.from
- let reqs = {}
+ const fromAddress = txParams.from
+ const reqs = {}
if (isUndef(txParams.gas)) reqs.gas = (cb) => this.query.estimateGas(txParams, cb)
if (isUndef(txParams.gasPrice)) reqs.gasPrice = (cb) => this.query.gasPrice(cb)
if (isUndef(txParams.nonce)) reqs.nonce = (cb) => this.query.getTransactionCount(fromAddress, 'pending', cb)
- async.parallel(reqs, function(err, result) {
+ async.parallel(reqs, function (err, result) {
if (err) return cb(err)
// write results to txParams obj
Object.assign(txParams, result)
@@ -123,14 +123,20 @@ module.exports = class txProviderUtils {
// util
-function isUndef(value) {
+function isUndef (value) {
return value === undefined
}
-function bnToHex(inputBn) {
+function bnToHex (inputBn) {
return ethUtil.addHexPrefix(inputBn.toString(16))
}
-function hexToBn(inputHex) {
+function hexToBn (inputHex) {
return new BN(ethUtil.stripHexPrefix(inputHex), 16)
}
+
+function BnMultiplyByFraction (targetBN, numerator, denominator) {
+ const numBN = new BN(numerator)
+ const denomBN = new BN(denominator)
+ return targetBN.mul(numBN).div(denomBN)
+}
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 2b8fc9cb8..a7eb3d056 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -4,13 +4,12 @@ const promiseToCallback = require('promise-to-callback')
const pipe = require('pump')
const Dnode = require('dnode')
const ObservableStore = require('obs-store')
-const storeTransform = require('obs-store/lib/transform')
const EthStore = require('./lib/eth-store')
const EthQuery = require('eth-query')
const streamIntoProvider = require('web3-stream-provider/handler')
-const MetaMaskProvider = require('web3-provider-engine/zero.js')
const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex
const KeyringController = require('./keyring-controller')
+const NetworkController = require('./controllers/network')
const PreferencesController = require('./controllers/preferences')
const CurrencyController = require('./controllers/currency')
const NoticeController = require('./notice-controller')
@@ -18,7 +17,7 @@ const ShapeShiftController = require('./controllers/shapeshift')
const AddressBookController = require('./controllers/address-book')
const MessageManager = require('./lib/message-manager')
const PersonalMessageManager = require('./lib/personal-message-manager')
-const TxManager = require('./transaction-manager')
+const TransactionController = require('./controllers/transactions')
const ConfigManager = require('./lib/config-manager')
const autoFaucet = require('./lib/auto-faucet')
const nodeify = require('./lib/nodeify')
@@ -32,7 +31,7 @@ module.exports = class MetamaskController extends EventEmitter {
constructor (opts) {
super()
this.opts = opts
- let initState = opts.initState || {}
+ const initState = opts.initState || {}
// platform-specific api
this.platform = opts.platform
@@ -41,8 +40,8 @@ module.exports = class MetamaskController extends EventEmitter {
this.store = new ObservableStore(initState)
// network store
- this.networkStore = new ObservableStore({ network: 'loading' })
+ this.networkController = new NetworkController(initState.NetworkController)
// config manager
this.configManager = new ConfigManager({
store: this.store,
@@ -62,8 +61,6 @@ module.exports = class MetamaskController extends EventEmitter {
// rpc provider
this.provider = this.initializeProvider()
- this.provider.on('block', this.logBlock.bind(this))
- this.provider.on('error', this.verifyNetwork.bind(this))
// eth data query tools
this.ethQuery = new EthQuery(this.provider)
@@ -76,7 +73,7 @@ module.exports = class MetamaskController extends EventEmitter {
this.keyringController = new KeyringController({
initState: initState.KeyringController,
ethStore: this.ethStore,
- getNetwork: this.getNetworkState.bind(this),
+ getNetwork: this.networkController.getNetworkState.bind(this.networkController),
})
this.keyringController.on('newAccount', (address) => {
this.preferencesController.setSelectedAddress(address)
@@ -91,15 +88,16 @@ module.exports = class MetamaskController extends EventEmitter {
}, this.keyringController)
// tx mgmt
- this.txManager = new TxManager({
- initState: initState.TransactionManager,
- networkStore: this.networkStore,
+ this.txController = new TransactionController({
+ initState: initState.TransactionController || initState.TransactionManager,
+ networkStore: this.networkController.networkStore,
preferencesStore: this.preferencesController.store,
txHistoryLimit: 40,
- getNetwork: this.getNetworkState.bind(this),
+ getNetwork: this.networkController.getNetworkState.bind(this),
signTransaction: this.keyringController.signTransaction.bind(this.keyringController),
provider: this.provider,
blockTracker: this.provider,
+ ethQuery: this.ethQuery,
})
// notices
@@ -114,14 +112,14 @@ module.exports = class MetamaskController extends EventEmitter {
initState: initState.ShapeShiftController,
})
- this.lookupNetwork()
+ this.networkController.lookupNetwork()
this.messageManager = new MessageManager()
this.personalMessageManager = new PersonalMessageManager()
this.publicConfigStore = this.initPublicConfigStore()
// manual disk state subscriptions
- this.txManager.store.subscribe((state) => {
- this.store.updateState({ TransactionManager: state })
+ this.txController.store.subscribe((state) => {
+ this.store.updateState({ TransactionController: state })
})
this.keyringController.store.subscribe((state) => {
this.store.updateState({ KeyringController: state })
@@ -141,11 +139,14 @@ module.exports = class MetamaskController extends EventEmitter {
this.shapeshiftController.store.subscribe((state) => {
this.store.updateState({ ShapeShiftController: state })
})
+ this.networkController.store.subscribe((state) => {
+ this.store.updateState({ NetworkController: state })
+ })
// manual mem state subscriptions
- this.networkStore.subscribe(this.sendUpdate.bind(this))
+ this.networkController.store.subscribe(this.sendUpdate.bind(this))
this.ethStore.subscribe(this.sendUpdate.bind(this))
- this.txManager.memStore.subscribe(this.sendUpdate.bind(this))
+ this.txController.memStore.subscribe(this.sendUpdate.bind(this))
this.messageManager.memStore.subscribe(this.sendUpdate.bind(this))
this.personalMessageManager.memStore.subscribe(this.sendUpdate.bind(this))
this.keyringController.memStore.subscribe(this.sendUpdate.bind(this))
@@ -161,17 +162,21 @@ module.exports = class MetamaskController extends EventEmitter {
//
initializeProvider () {
-
- let provider = MetaMaskProvider({
+ return this.networkController.initializeProvider({
static: {
eth_syncing: false,
web3_clientVersion: `MetaMask/v${version}`,
},
- rpcUrl: this.configManager.getCurrentRpcAddress(),
+ rpcUrl: this.networkController.getCurrentRpcAddress(),
// account mgmt
getAccounts: (cb) => {
- let selectedAddress = this.preferencesController.getSelectedAddress()
- let result = selectedAddress ? [selectedAddress] : []
+ const isUnlocked = this.keyringController.memStore.getState().isUnlocked
+ const result = []
+ const selectedAddress = this.preferencesController.getSelectedAddress()
+ // only show address if account is unlocked
+ if (isUnlocked && selectedAddress) {
+ result.push(selectedAddress)
+ }
cb(null, result)
},
// tx signing
@@ -182,26 +187,23 @@ module.exports = class MetamaskController extends EventEmitter {
// new style msg signing
processPersonalMessage: this.newUnsignedPersonalMessage.bind(this),
})
- return provider
}
initPublicConfigStore () {
// get init state
const publicConfigStore = new ObservableStore()
- // sync publicConfigStore with transform
- pipe(
- this.store,
- storeTransform(selectPublicState.bind(this)),
- publicConfigStore
- )
+ // memStore -> transform -> publicConfigStore
+ this.on('update', (memState) => {
+ const publicState = selectPublicState(memState)
+ publicConfigStore.putState(publicState)
+ })
- function selectPublicState(state) {
- const result = { selectedAddress: undefined }
- try {
- result.selectedAddress = state.PreferencesController.selectedAddress
- result.networkVersion = this.getNetworkState()
- } catch (_) {}
+ function selectPublicState (memState) {
+ const result = {
+ selectedAddress: memState.isUnlocked ? memState.selectedAddress : undefined,
+ networkVersion: memState.network,
+ }
return result
}
@@ -220,9 +222,9 @@ module.exports = class MetamaskController extends EventEmitter {
{
isInitialized,
},
- this.networkStore.getState(),
+ this.networkController.store.getState(),
this.ethStore.getState(),
- this.txManager.memStore.getState(),
+ this.txController.memStore.getState(),
this.messageManager.memStore.getState(),
this.personalMessageManager.memStore.getState(),
this.keyringController.memStore.getState(),
@@ -247,62 +249,61 @@ module.exports = class MetamaskController extends EventEmitter {
getApi () {
const keyringController = this.keyringController
const preferencesController = this.preferencesController
- const txManager = this.txManager
+ const txController = this.txController
const noticeController = this.noticeController
const addressBookController = this.addressBookController
return {
// etc
- getState: (cb) => cb(null, this.getState()),
- setProviderType: this.setProviderType.bind(this),
- useEtherscanProvider: this.useEtherscanProvider.bind(this),
- setCurrentCurrency: this.setCurrentCurrency.bind(this),
- markAccountsFound: this.markAccountsFound.bind(this),
+ getState: (cb) => cb(null, this.getState()),
+ setProviderType: this.networkController.setProviderType.bind(this.networkController),
+ setCurrentCurrency: this.setCurrentCurrency.bind(this),
+ markAccountsFound: this.markAccountsFound.bind(this),
// coinbase
buyEth: this.buyEth.bind(this),
// shapeshift
createShapeShiftTx: this.createShapeShiftTx.bind(this),
// primary HD keyring management
- addNewAccount: this.addNewAccount.bind(this),
- placeSeedWords: this.placeSeedWords.bind(this),
- clearSeedWordCache: this.clearSeedWordCache.bind(this),
- importAccountWithStrategy: this.importAccountWithStrategy.bind(this),
+ addNewAccount: this.addNewAccount.bind(this),
+ placeSeedWords: this.placeSeedWords.bind(this),
+ clearSeedWordCache: this.clearSeedWordCache.bind(this),
+ importAccountWithStrategy: this.importAccountWithStrategy.bind(this),
// vault management
submitPassword: this.submitPassword.bind(this),
// PreferencesController
- setSelectedAddress: nodeify(preferencesController.setSelectedAddress).bind(preferencesController),
- setDefaultRpc: nodeify(this.setDefaultRpc).bind(this),
- setCustomRpc: nodeify(this.setCustomRpc).bind(this),
+ setSelectedAddress: nodeify(preferencesController.setSelectedAddress).bind(preferencesController),
+ setDefaultRpc: nodeify(this.setDefaultRpc).bind(this),
+ setCustomRpc: nodeify(this.setCustomRpc).bind(this),
// AddressController
- setAddressBook: nodeify(addressBookController.setAddressBook).bind(addressBookController),
+ setAddressBook: nodeify(addressBookController.setAddressBook).bind(addressBookController),
// KeyringController
- setLocked: nodeify(keyringController.setLocked).bind(keyringController),
+ setLocked: nodeify(keyringController.setLocked).bind(keyringController),
createNewVaultAndKeychain: nodeify(keyringController.createNewVaultAndKeychain).bind(keyringController),
- createNewVaultAndRestore: nodeify(keyringController.createNewVaultAndRestore).bind(keyringController),
- addNewKeyring: nodeify(keyringController.addNewKeyring).bind(keyringController),
- saveAccountLabel: nodeify(keyringController.saveAccountLabel).bind(keyringController),
- exportAccount: nodeify(keyringController.exportAccount).bind(keyringController),
-
- // txManager
- approveTransaction: txManager.approveTransaction.bind(txManager),
- cancelTransaction: txManager.cancelTransaction.bind(txManager),
+ createNewVaultAndRestore: nodeify(keyringController.createNewVaultAndRestore).bind(keyringController),
+ addNewKeyring: nodeify(keyringController.addNewKeyring).bind(keyringController),
+ saveAccountLabel: nodeify(keyringController.saveAccountLabel).bind(keyringController),
+ exportAccount: nodeify(keyringController.exportAccount).bind(keyringController),
+
+ // txController
+ approveTransaction: txController.approveTransaction.bind(txController),
+ cancelTransaction: txController.cancelTransaction.bind(txController),
updateAndApproveTransaction: this.updateAndApproveTx.bind(this),
// messageManager
- signMessage: nodeify(this.signMessage).bind(this),
- cancelMessage: this.cancelMessage.bind(this),
+ signMessage: nodeify(this.signMessage).bind(this),
+ cancelMessage: this.cancelMessage.bind(this),
// personalMessageManager
- signPersonalMessage: nodeify(this.signPersonalMessage).bind(this),
- cancelPersonalMessage: this.cancelPersonalMessage.bind(this),
+ signPersonalMessage: nodeify(this.signPersonalMessage).bind(this),
+ cancelPersonalMessage: this.cancelPersonalMessage.bind(this),
// notices
- checkNotices: noticeController.updateNoticesList.bind(noticeController),
+ checkNotices: noticeController.updateNoticesList.bind(noticeController),
markNoticeRead: noticeController.markNoticeRead.bind(noticeController),
}
}
@@ -342,9 +343,7 @@ module.exports = class MetamaskController extends EventEmitter {
console.error('Error in RPC response:\n', response.error)
}
if (request.isMetamaskInternal) return
- if (global.METAMASK_DEBUG) {
- console.log(`RPC (${originDomain}):`, request, '->', response)
- }
+ log.info(`RPC (${originDomain}):`, request, '->', response)
}
}
@@ -422,12 +421,12 @@ module.exports = class MetamaskController extends EventEmitter {
newUnapprovedTransaction (txParams, cb) {
log.debug(`MetaMaskController newUnapprovedTransaction ${JSON.stringify(txParams)}`)
const self = this
- self.txManager.addUnapprovedTransaction(txParams, (err, txMeta) => {
+ self.txController.addUnapprovedTransaction(txParams, (err, txMeta) => {
if (err) return cb(err)
self.sendUpdate()
self.opts.showUnapprovedTx(txMeta)
// listen for tx completion (success, fail)
- self.txManager.once(`${txMeta.id}:finished`, (completedTx) => {
+ self.txController.once(`${txMeta.id}:finished`, (completedTx) => {
switch (completedTx.status) {
case 'submitted':
return cb(null, completedTx.hash)
@@ -441,7 +440,7 @@ module.exports = class MetamaskController extends EventEmitter {
}
newUnsignedMessage (msgParams, cb) {
- let msgId = this.messageManager.addUnapprovedMessage(msgParams)
+ const msgId = this.messageManager.addUnapprovedMessage(msgParams)
this.sendUpdate()
this.opts.showUnconfirmedMessage()
this.messageManager.once(`${msgId}:finished`, (data) => {
@@ -461,7 +460,7 @@ module.exports = class MetamaskController extends EventEmitter {
return cb(new Error('MetaMask Message Signature: from field is required.'))
}
- let msgId = this.personalMessageManager.addUnapprovedMessage(msgParams)
+ const msgId = this.personalMessageManager.addUnapprovedMessage(msgParams)
this.sendUpdate()
this.opts.showUnconfirmedMessage()
this.personalMessageManager.once(`${msgId}:finished`, (data) => {
@@ -476,11 +475,11 @@ module.exports = class MetamaskController extends EventEmitter {
})
}
- updateAndApproveTx(txMeta, cb) {
+ updateAndApproveTx (txMeta, cb) {
log.debug(`MetaMaskController - updateAndApproveTx: ${JSON.stringify(txMeta)}`)
- const txManager = this.txManager
- txManager.updateTx(txMeta)
- txManager.approveTransaction(txMeta.id, cb)
+ const txController = this.txController
+ txController.updateTx(txMeta)
+ txController.approveTransaction(txMeta.id, cb)
}
signMessage (msgParams, cb) {
@@ -502,7 +501,7 @@ module.exports = class MetamaskController extends EventEmitter {
})
}
- cancelMessage(msgId, cb) {
+ cancelMessage (msgId, cb) {
const messageManager = this.messageManager
messageManager.rejectMsg(msgId)
if (cb && typeof cb === 'function') {
@@ -512,7 +511,7 @@ module.exports = class MetamaskController extends EventEmitter {
// Prefixed Style Message Signing Methods:
approvePersonalMessage (msgParams, cb) {
- let msgId = this.personalMessageManager.addUnapprovedMessage(msgParams)
+ const msgId = this.personalMessageManager.addUnapprovedMessage(msgParams)
this.sendUpdate()
this.opts.showUnconfirmedMessage()
this.personalMessageManager.once(`${msgId}:finished`, (data) => {
@@ -545,7 +544,7 @@ module.exports = class MetamaskController extends EventEmitter {
})
}
- cancelPersonalMessage(msgId, cb) {
+ cancelPersonalMessage (msgId, cb) {
const messageManager = this.personalMessageManager
messageManager.rejectMsg(msgId)
if (cb && typeof cb === 'function') {
@@ -559,13 +558,13 @@ module.exports = class MetamaskController extends EventEmitter {
cb(null, this.getState())
}
- restoreOldVaultAccounts(migratorOutput) {
+ restoreOldVaultAccounts (migratorOutput) {
const { serialized } = migratorOutput
return this.keyringController.restoreKeyring(serialized)
.then(() => migratorOutput)
}
- restoreOldLostAccounts(migratorOutput) {
+ restoreOldLostAccounts (migratorOutput) {
const { lostAccounts } = migratorOutput
if (lostAccounts) {
this.configManager.setLostAccounts(lostAccounts.map(acct => acct.address))
@@ -591,12 +590,6 @@ module.exports = class MetamaskController extends EventEmitter {
//
// Log blocks
- logBlock (block) {
- if (global.METAMASK_DEBUG) {
- console.log(`BLOCK CHANGED: #${block.number.toString('hex')} 0x${block.hash.toString('hex')}`)
- }
- this.verifyNetwork()
- }
setCurrentCurrency (currencyCode, cb) {
try {
@@ -615,7 +608,7 @@ module.exports = class MetamaskController extends EventEmitter {
buyEth (address, amount) {
if (!amount) amount = '5'
- const network = this.getNetworkState()
+ const network = this.networkController.getNetworkState()
const url = getBuyEthUrl({ network, address, amount })
if (url) this.platform.openWindow({ url })
}
@@ -623,71 +616,21 @@ module.exports = class MetamaskController extends EventEmitter {
createShapeShiftTx (depositAddress, depositType) {
this.shapeshiftController.createShapeShiftTx(depositAddress, depositType)
}
-
- //
- // network
- //
-
- verifyNetwork () {
- // Check network when restoring connectivity:
- if (this.isNetworkLoading()) this.lookupNetwork()
- }
+// network
setDefaultRpc () {
- this.configManager.setRpcTarget('http://localhost:8545')
- this.platform.reload()
- this.lookupNetwork()
+ this.networkController.setRpcTarget('http://localhost:8545')
return Promise.resolve('http://localhost:8545')
}
setCustomRpc (rpcTarget, rpcList) {
- this.configManager.setRpcTarget(rpcTarget)
- return this.preferencesController.updateFrequentRpcList(rpcTarget)
- .then(() => {
- this.platform.reload()
- this.lookupNetwork()
- return Promise.resolve(rpcTarget)
- })
- }
-
- setProviderType (type) {
- this.configManager.setProviderType(type)
- this.platform.reload()
- this.lookupNetwork()
- }
-
- useEtherscanProvider () {
- this.configManager.useEtherscanProvider()
- this.platform.reload()
- }
-
- getNetworkState () {
- return this.networkStore.getState().network
- }
-
- setNetworkState (network) {
- return this.networkStore.updateState({ network })
- }
+ this.networkController.setRpcTarget(rpcTarget)
- isNetworkLoading () {
- return this.getNetworkState() === 'loading'
- }
-
- lookupNetwork (err) {
- if (err) {
- this.setNetworkState('loading')
- }
-
- this.ethQuery.sendAsync({ method: 'net_version' }, (err, network) => {
- if (err) {
- this.setNetworkState('loading')
- return
- }
- if (global.METAMASK_DEBUG) {
- console.log('web3.getNetwork returned ' + network)
- }
- this.setNetworkState(network)
+ return this.preferencesController.updateFrequentRpcList(rpcTarget)
+ .then(() => {
+ return Promise.resolve(rpcTarget)
})
}
+
}
diff --git a/app/scripts/migrations/002.js b/app/scripts/migrations/002.js
index 36a870342..b1d88f2ef 100644
--- a/app/scripts/migrations/002.js
+++ b/app/scripts/migrations/002.js
@@ -7,7 +7,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
if (versionedData.data.config.provider.type === 'etherscan') {
diff --git a/app/scripts/migrations/003.js b/app/scripts/migrations/003.js
index 1893576ad..140f81d40 100644
--- a/app/scripts/migrations/003.js
+++ b/app/scripts/migrations/003.js
@@ -8,7 +8,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
if (versionedData.data.config.provider.rpcTarget === oldTestRpc) {
diff --git a/app/scripts/migrations/004.js b/app/scripts/migrations/004.js
index 405d932f8..cd558300c 100644
--- a/app/scripts/migrations/004.js
+++ b/app/scripts/migrations/004.js
@@ -6,7 +6,7 @@ module.exports = {
version,
migrate: function (versionedData) {
- let safeVersionedData = clone(versionedData)
+ const safeVersionedData = clone(versionedData)
safeVersionedData.meta.version = version
try {
if (safeVersionedData.data.config.provider.type !== 'rpc') return Promise.resolve(safeVersionedData)
diff --git a/app/scripts/migrations/005.js b/app/scripts/migrations/005.js
index e4b84f460..f7b68dfe4 100644
--- a/app/scripts/migrations/005.js
+++ b/app/scripts/migrations/005.js
@@ -14,7 +14,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
diff --git a/app/scripts/migrations/006.js b/app/scripts/migrations/006.js
index 94d1b6ecd..51ea6e3e7 100644
--- a/app/scripts/migrations/006.js
+++ b/app/scripts/migrations/006.js
@@ -13,7 +13,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
diff --git a/app/scripts/migrations/007.js b/app/scripts/migrations/007.js
index 236e35224..d9887b9c8 100644
--- a/app/scripts/migrations/007.js
+++ b/app/scripts/migrations/007.js
@@ -13,7 +13,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
diff --git a/app/scripts/migrations/008.js b/app/scripts/migrations/008.js
index cd5e95d22..da7cb2e60 100644
--- a/app/scripts/migrations/008.js
+++ b/app/scripts/migrations/008.js
@@ -13,7 +13,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
diff --git a/app/scripts/migrations/009.js b/app/scripts/migrations/009.js
index 4612fefdc..f47db55ac 100644
--- a/app/scripts/migrations/009.js
+++ b/app/scripts/migrations/009.js
@@ -13,7 +13,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
diff --git a/app/scripts/migrations/010.js b/app/scripts/migrations/010.js
index c0cc56ae4..e4b9ac07e 100644
--- a/app/scripts/migrations/010.js
+++ b/app/scripts/migrations/010.js
@@ -13,7 +13,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
diff --git a/app/scripts/migrations/011.js b/app/scripts/migrations/011.js
index 0d5d6d307..782ec809d 100644
--- a/app/scripts/migrations/011.js
+++ b/app/scripts/migrations/011.js
@@ -12,7 +12,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
diff --git a/app/scripts/migrations/012.js b/app/scripts/migrations/012.js
index 8361b3793..f69ccbb02 100644
--- a/app/scripts/migrations/012.js
+++ b/app/scripts/migrations/012.js
@@ -12,7 +12,7 @@ module.exports = {
version,
migrate: function (originalVersionedData) {
- let versionedData = clone(originalVersionedData)
+ const versionedData = clone(originalVersionedData)
versionedData.meta.version = version
try {
const state = versionedData.data
diff --git a/app/scripts/migrations/013.js b/app/scripts/migrations/013.js
new file mode 100644
index 000000000..8f11e510e
--- /dev/null
+++ b/app/scripts/migrations/013.js
@@ -0,0 +1,34 @@
+const version = 13
+
+/*
+
+This migration modifies the network config from ambiguous 'testnet' to explicit 'ropsten'
+
+*/
+
+const clone = require('clone')
+
+module.exports = {
+ version,
+
+ migrate: function (originalVersionedData) {
+ const versionedData = clone(originalVersionedData)
+ versionedData.meta.version = version
+ try {
+ const state = versionedData.data
+ const newState = transformState(state)
+ versionedData.data = newState
+ } catch (err) {
+ console.warn(`MetaMask Migration #${version}` + err.stack)
+ }
+ return Promise.resolve(versionedData)
+ },
+}
+
+function transformState (state) {
+ const newState = state
+ if (newState.config.provider.type === 'testnet') {
+ newState.config.provider.type = 'ropsten'
+ }
+ return newState
+}
diff --git a/app/scripts/migrations/014.js b/app/scripts/migrations/014.js
new file mode 100644
index 000000000..0fe92125b
--- /dev/null
+++ b/app/scripts/migrations/014.js
@@ -0,0 +1,34 @@
+const version = 14
+
+/*
+
+This migration removes provider from config and moves it too NetworkController.
+
+*/
+
+const clone = require('clone')
+
+module.exports = {
+ version,
+
+ migrate: function (originalVersionedData) {
+ const versionedData = clone(originalVersionedData)
+ versionedData.meta.version = version
+ try {
+ const state = versionedData.data
+ const newState = transformState(state)
+ versionedData.data = newState
+ } catch (err) {
+ console.warn(`MetaMask Migration #${version}` + err.stack)
+ }
+ return Promise.resolve(versionedData)
+ },
+}
+
+function transformState (state) {
+ const newState = state
+ newState.NetworkController = {}
+ newState.NetworkController.provider = newState.config.provider
+ delete newState.config.provider
+ return newState
+}
diff --git a/app/scripts/migrations/_multi-keyring.js b/app/scripts/migrations/_multi-keyring.js
index 04c966d4d..253aa3d9d 100644
--- a/app/scripts/migrations/_multi-keyring.js
+++ b/app/scripts/migrations/_multi-keyring.js
@@ -15,15 +15,15 @@ const KeyringController = require('../../app/scripts/lib/keyring-controller')
const password = 'obviously not correct'
module.exports = {
- version,
+ version,
migrate: function (versionedData) {
versionedData.meta.version = version
- let store = new ObservableStore(versionedData.data)
- let configManager = new ConfigManager({ store })
- let idStoreMigrator = new IdentityStoreMigrator({ configManager })
- let keyringController = new KeyringController({
+ const store = new ObservableStore(versionedData.data)
+ const configManager = new ConfigManager({ store })
+ const idStoreMigrator = new IdentityStoreMigrator({ configManager })
+ const keyringController = new KeyringController({
configManager: configManager,
})
@@ -46,6 +46,5 @@ module.exports = {
return Promise.resolve(versionedData)
})
})
-
},
}
diff --git a/app/scripts/migrations/index.js b/app/scripts/migrations/index.js
index 019b4d13d..fb1ad7863 100644
--- a/app/scripts/migrations/index.js
+++ b/app/scripts/migrations/index.js
@@ -23,4 +23,6 @@ module.exports = [
require('./010'),
require('./011'),
require('./012'),
+ require('./013'),
+ require('./014'),
]
diff --git a/app/scripts/popup-core.js b/app/scripts/popup-core.js
index 1e5d70e8b..f1eb394d7 100644
--- a/app/scripts/popup-core.js
+++ b/app/scripts/popup-core.js
@@ -1,7 +1,7 @@
const EventEmitter = require('events').EventEmitter
const async = require('async')
const Dnode = require('dnode')
-const Web3 = require('web3')
+const EthQuery = require('eth-query')
const launchMetamaskUi = require('../../ui')
const StreamProvider = require('web3-stream-provider')
const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex
@@ -16,7 +16,6 @@ function initializePopup ({ container, connectionStream }, cb) {
(cb) => connectToAccountManager(connectionStream, cb),
(accountManager, cb) => launchMetamaskUi({ container, accountManager }, cb),
], cb)
-
}
function connectToAccountManager (connectionStream, cb) {
@@ -33,7 +32,8 @@ function setupWeb3Connection (connectionStream) {
providerStream.pipe(connectionStream).pipe(providerStream)
connectionStream.on('error', console.error.bind(console))
providerStream.on('error', console.error.bind(console))
- global.web3 = new Web3(providerStream)
+ global.ethereumProvider = providerStream
+ global.ethQuery = new EthQuery(providerStream)
}
function setupControllerConnection (connectionStream, cb) {
diff --git a/app/scripts/popup.js b/app/scripts/popup.js
index 0fbde54b3..5f17f0651 100644
--- a/app/scripts/popup.js
+++ b/app/scripts/popup.js
@@ -41,7 +41,7 @@ function closePopupIfOpen (windowType) {
}
}
-function displayCriticalError(err) {
+function displayCriticalError (err) {
container.innerHTML = '<div class="critical-error">The MetaMask app failed to load: please open and close MetaMask again to restart.</div>'
container.style.height = '80px'
log.error(err.stack)
diff --git a/circle.yml b/circle.yml
index c9ea787ff..4305ca3b4 100644
--- a/circle.yml
+++ b/circle.yml
@@ -1,6 +1,6 @@
machine:
node:
- version: 6.0.0
+ version: 7.6.0
dependencies:
pre:
- "npm i -g testem"
diff --git a/development/announcer.js b/development/announcer.js
index 110d41fd4..43ae60acb 100644
--- a/development/announcer.js
+++ b/development/announcer.js
@@ -7,6 +7,6 @@ var changelog = fs.readFileSync(path.join(__dirname, '..', 'CHANGELOG.md')).toSt
var log = changelog.split(version)[1].split('##')[0].trim()
-let msg = `*MetaMask ${version}* now published to the Chrome Store! It should auto-update over the next hour!\n${log}`
+let msg = `*MetaMask ${version}* now published to the Chrome Store! It should auto-update soon!\n${log}`
console.log(msg)
diff --git a/docs/add-to-chrome.md b/docs/add-to-chrome.md
new file mode 100644
index 000000000..ea5213182
--- /dev/null
+++ b/docs/add-to-chrome.md
@@ -0,0 +1,14 @@
+## Add Custom Build to Chrome
+
+Open `Settings` > `Extensions`.
+
+Check "Developer mode".
+
+At the top, click `Load Unpacked Extension`.
+
+Navigate to your `metamask-plugin/dist/chrome` folder.
+
+Click `Select`.
+
+You now have the plugin, and can click 'inspect views: background plugin' to view its dev console.
+
diff --git a/docs/add-to-firef.md b/docs/add-to-firef.md
new file mode 100644
index 000000000..593d06170
--- /dev/null
+++ b/docs/add-to-firef.md
@@ -0,0 +1,14 @@
+# Add Custom Build to Firefox
+
+Go to the url `about:debugging`.
+
+Click the button `Load Temporary Add-On`.
+
+Select the file `dist/firefox/manifest.json`.
+
+You can optionally enable debugging, and click `Debug`, for a console window that logs all of Metamask's processes to a single console.
+
+If you have problems debugging, try connecting to the IRC channel `#webextensions` on `irc.mozilla.org`.
+
+For longer questions, use the StackOverfow tag `firefox-addons`.
+
diff --git a/docs/adding-new-networks.md b/docs/adding-new-networks.md
new file mode 100644
index 000000000..ea1453c21
--- /dev/null
+++ b/docs/adding-new-networks.md
@@ -0,0 +1,25 @@
+## Adding Custom Networks
+
+To add another network to our dropdown menu, make sure the following files are adjusted properly:
+
+```
+app/scripts/config.js
+app/scripts/lib/buy-eth-url.js
+app/scripts/lib/config-manager.js
+ui/app/app.js
+ui/app/components/buy-button-subview.js
+ui/app/components/drop-menu-item.js
+ui/app/components/network.js
+ui/app/components/transaction-list-item.js
+ui/app/config.js
+ui/app/css/lib.css
+ui/lib/account-link.js
+ui/lib/explorer-link.js
+```
+
+You will need:
++ The network ID
++ An RPC Endpoint url
++ An explorer link
++ CSS for the display icon
+
diff --git a/docs/developing-on-deps.md b/docs/developing-on-deps.md
new file mode 100644
index 000000000..7de3f67a8
--- /dev/null
+++ b/docs/developing-on-deps.md
@@ -0,0 +1,10 @@
+### Developing on Dependencies
+
+To enjoy the live-reloading that `gulp dev` offers while working on the `web3-provider-engine` or other dependencies:
+
+ 1. Clone the dependency locally.
+ 2. `npm install` in its folder.
+ 3. Run `npm link` in its folder.
+ 4. Run `npm link $DEP_NAME` in this project folder.
+ 5. Next time you `npm start` it will watch the dependency for changes as well!
+
diff --git a/docs/development-visualization.md b/docs/development-visualization.md
new file mode 100644
index 000000000..95847300d
--- /dev/null
+++ b/docs/development-visualization.md
@@ -0,0 +1,35 @@
+### Generate Development Visualization
+
+This will generate a video of the repo commit history.
+
+Install preqs:
+```
+brew install gource
+brew install ffmpeg
+```
+
+From the repo dir, pipe `gource` into `ffmpeg`:
+```
+gource \
+ --seconds-per-day .1 \
+ --user-scale 1.5 \
+ --default-user-image "./images/icon-512.png" \
+ --viewport 1280x720 \
+ --auto-skip-seconds .1 \
+ --multi-sampling \
+ --stop-at-end \
+ --highlight-users \
+ --hide mouse,progress \
+ --file-idle-time 0 \
+ --max-files 0 \
+ --background-colour 000000 \
+ --font-size 18 \
+ --date-format "%b %d, %Y" \
+ --highlight-dirs \
+ --user-friction 0.1 \
+ --title "MetaMask Development History" \
+ --output-ppm-stream - \
+ --output-framerate 30 \
+ | ffmpeg -y -r 30 -f image2pipe -vcodec ppm -i - -b 65536K metamask-dev-history.mp4
+```
+
diff --git a/docs/notices.md b/docs/notices.md
new file mode 100644
index 000000000..826e6e84e
--- /dev/null
+++ b/docs/notices.md
@@ -0,0 +1,15 @@
+## Generating Notices
+
+To add a notice:
+```
+npm run generateNotice
+```
+Enter the body of your notice into the text editor that pops up, without including the body. Be sure to save the file before closing the window!
+Afterwards, enter the title of the notice in the command line and press enter. Afterwards, add and commit the new changes made.
+
+To delete a notice:
+```
+npm run deleteNotice
+```
+A list of active notices will pop up. Enter the corresponding id in the command line prompt and add and commit the new changes afterwards.
+
diff --git a/docs/publishing.md b/docs/publishing.md
new file mode 100644
index 000000000..00369acf9
--- /dev/null
+++ b/docs/publishing.md
@@ -0,0 +1,19 @@
+# Publishing Guide
+
+When publishing a new version of MetaMask, we follow this procedure:
+
+## Incrementing Version & Changelog
+
+ You must be authorized already on the MetaMask plugin.
+
+1. Update the version in `app/manifest.json` and the Changelog in `CHANGELOG.md`.
+2. Visit [the chrome developer dashboard](https://chrome.google.com/webstore/developer/dashboard?authuser=2).
+
+## Publishing
+
+1. `npm run dist` to generate the latest build.
+2. Publish to chrome store.
+3. Publish to firefox addon marketplace.
+4. Post on Github releases page.
+5. `npm run announce`, post that announcement in our public places.
+
diff --git a/docs/ui-dev-mode.md b/docs/ui-dev-mode.md
new file mode 100644
index 000000000..df49d8b04
--- /dev/null
+++ b/docs/ui-dev-mode.md
@@ -0,0 +1,6 @@
+# Running UI Dev Mode
+
+You can run `npm run ui`, and your browser should open a live-reloading demo version of the plugin UI.
+
+Some actions will crash the app, so this is only for tuning aesthetics, but it allows live-reloading styles, which is a much faster feedback loop than reloading the full extension.
+
diff --git a/docs/ui-mock-mode.md b/docs/ui-mock-mode.md
new file mode 100644
index 000000000..bb54dc471
--- /dev/null
+++ b/docs/ui-mock-mode.md
@@ -0,0 +1,8 @@
+### Developing on UI with Mocked Background Process
+
+You can run `npm run mock` and your browser should open a live-reloading demo version of the plugin UI, just like the `npm run ui`, except that it tries to actually perform all normal operations.
+
+It does not yet connect to a real blockchain (this could be a good test feature later, connecting to a test blockchain), so only local operations work.
+
+You can reset the mock ui at any time with the `Reset` button at the top of the screen.
+
diff --git a/gulpfile.js b/gulpfile.js
index fe223adf1..5bba1b9b3 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -52,6 +52,15 @@ gulp.task('copy:images', copyTask({
'./dist/opera/images',
],
}))
+gulp.task('copy:contractImages', copyTask({
+ source: './node_modules/ethereum-contract-icons/images/',
+ destinations: [
+ './dist/firefox/images/contract',
+ './dist/chrome/images/contract',
+ './dist/edge/images/contract',
+ './dist/opera/images/contract',
+ ],
+}))
gulp.task('copy:fonts', copyTask({
source: './app/fonts/',
destinations: [
@@ -127,6 +136,7 @@ const staticFiles = [
]
var copyStrings = staticFiles.map(staticFile => `copy:${staticFile}`)
+copyStrings.push('copy:contractImages')
if (!disableLiveReload) {
copyStrings.push('copy:reload')
@@ -182,7 +192,7 @@ gulp.task('build:js', gulp.parallel(...jsBuildStrings))
// disc bundle analyzer tasks
jsFiles.forEach((jsFile) => {
- gulp.task(`disc:${jsFile}`, bundleTask({ label: jsFile, filename: `${jsFile}.js` }))
+ gulp.task(`disc:${jsFile}`, discTask({ label: jsFile, filename: `${jsFile}.js` }))
})
gulp.task('disc', gulp.parallel(jsFiles.map(jsFile => `disc:${jsFile}`)))
@@ -296,8 +306,6 @@ function bundleTask(opts) {
return (
bundler.bundle()
- // log errors if they happen
- .on('error', gutil.log.bind(gutil, 'Browserify Error'))
// convert bundle stream to gulp vinyl stream
.pipe(source(opts.filename))
// inject variables into bundle
diff --git a/mascara/README.md b/mascara/README.md
index cdeb4795c..6e3bfe96b 100644
--- a/mascara/README.md
+++ b/mascara/README.md
@@ -1,20 +1,33 @@
start the dual servers (dapp + mascara)
```
-node server.js
+npm run mascara
```
-## First time use:
+### First time use:
-- navigate to: http://localhost:9001/popup/popup.html
+- navigate to: http://localhost:9001
- Create an Account
-- go back to http://localhost:9002/
+- go back to http://localhost:9002
- open devTools
- click Sync Tx
-### Todos
+### Tests:
- - [ ] Figure out user flows and UI redesign
- - [ ] Figure out FireFox
- Standing problems:
- - [ ] IndexDb
+```
+npm run testMascara
+```
+
+Test will run in browser, you will have to have these browsers installed:
+
+- Chrome
+- Firefox
+- Opera
+
+### Deploy:
+
+Will build and deploy mascara via docker
+
+```
+docker-compose build && docker-compose stop && docker-compose up -d && docker-compose logs --tail 200 -f
+``` \ No newline at end of file
diff --git a/mascara/src/background.js b/mascara/src/background.js
index 957570050..d9dbf593a 100644
--- a/mascara/src/background.js
+++ b/mascara/src/background.js
@@ -1,4 +1,5 @@
global.window = global
+const self = global
const pipe = require('pump')
const SwGlobalListener = require('sw-stream/lib/sw-global-listener.js')
@@ -6,7 +7,7 @@ const connectionListener = new SwGlobalListener(self)
const setupMultiplex = require('../../app/scripts/lib/stream-utils.js').setupMultiplex
const PortStream = require('../../app/scripts/lib/port-stream.js')
-const DbController = require('./lib/index-db-controller')
+const DbController = require('idb-global')
const SwPlatform = require('../../app/scripts/platforms/sw')
const MetamaskController = require('../../app/scripts/metamask-controller')
@@ -21,6 +22,7 @@ const STORAGE_KEY = 'metamask-config'
// const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
const METAMASK_DEBUG = true
let popupIsOpen = false
+let connectedClientCount = 0
const log = require('loglevel')
global.log = log
@@ -40,7 +42,6 @@ console.log('inside:open')
let diskStore
const dbController = new DbController({
key: STORAGE_KEY,
- version: 2,
})
loadStateFromPersistence()
.then((initState) => setupController(initState))
@@ -107,6 +108,7 @@ function setupController (initState, client) {
connectionListener.on('remote', (portStream, messageEvent) => {
console.log('REMOTE CONECTION FOUND***********')
+ connectedClientCount += 1
connectRemote(portStream, messageEvent.data.context)
})
@@ -142,4 +144,12 @@ function setupController (initState, client) {
return Promise.resolve()
}
+
+function sendMessageToAllClients (message) {
+ self.clients.matchAll().then(function(clients) {
+ clients.forEach(function(client) {
+ client.postMessage(message)
+ })
+ })
+}
function noop () {}
diff --git a/mascara/src/lib/index-db-controller.js b/mascara/src/lib/index-db-controller.js
deleted file mode 100644
index 8db1d5d21..000000000
--- a/mascara/src/lib/index-db-controller.js
+++ /dev/null
@@ -1,88 +0,0 @@
-const EventEmitter = require('events')
-module.exports = class IndexDbController extends EventEmitter {
-
- constructor (opts) {
- super()
- this.migrations = opts.migrations
- this.key = opts.key
- this.dbObject = global.indexedDB
- this.IDBTransaction = global.IDBTransaction || global.webkitIDBTransaction || global.msIDBTransaction || {READ_WRITE: "readwrite"}; // This line should only be needed if it is needed to support the object's constants for older browsers
- this.IDBKeyRange = global.IDBKeyRange || global.webkitIDBKeyRange || global.msIDBKeyRange;
- this.version = opts.version
- this.logging = opts.logging
- this.initialState = opts.initialState
- if (this.logging) this.on('log', logger)
- }
-
- // Opens the database connection and returns a promise
- open (version = this.version) {
- return new Promise((resolve, reject) => {
- const dbOpenRequest = this.dbObject.open(this.key, version)
- dbOpenRequest.onerror = (event) => {
- return reject(event)
- }
- dbOpenRequest.onsuccess = (event) => {
- this.db = dbOpenRequest.result
- this.emit('success')
- resolve(this.db)
- }
- dbOpenRequest.onupgradeneeded = (event) => {
- this.db = event.target.result
- this.db.createObjectStore('dataStore')
- }
- })
- .then((openRequest) => {
- return this.get('dataStore')
- })
- .then((data) => {
- if (!data) {
- return this._add('dataStore', this.initialState)
- .then(() => this.get('dataStore'))
- .then((versionedData) => Promise.resolve(versionedData))
- }
- return Promise.resolve(data)
- })
- }
-
- requestObjectStore (key, type = 'readonly') {
- return new Promise((resolve, reject) => {
- const dbReadWrite = this.db.transaction(key, type)
- const dataStore = dbReadWrite.objectStore(key)
- resolve(dataStore)
- })
- }
-
- get (key = 'dataStore') {
- return this.requestObjectStore(key)
- .then((dataObject)=> {
- return new Promise((resolve, reject) => {
- const getRequest = dataObject.get(key)
- getRequest.onsuccess = (event) => resolve(event.currentTarget.result)
- getRequest.onerror = (event) => reject(event)
- })
- })
- }
-
- put (state) {
- return this.requestObjectStore('dataStore', 'readwrite')
- .then((dataObject)=> {
- const putRequest = dataObject.put(state, 'dataStore')
- putRequest.onsuccess = (event) => Promise.resolve(event.currentTarget.result)
- putRequest.onerror = (event) => Promise.reject(event)
- })
- }
-
- _add (key, objStore, cb = logger) {
- return this.requestObjectStore(key, 'readwrite')
- .then((dataObject)=> {
- const addRequest = dataObject.add(objStore, key)
- addRequest.onsuccess = (event) => Promise.resolve(event.currentTarget.result)
- addRequest.onerror = (event) => Promise.reject(event)
- })
- }
-
-}
-
-function logger (err, ress) {
- err ? console.error(`Logger says: ${err}`) : console.dir(`Logger says: ${ress}`)
-}
diff --git a/mascara/src/mascara.js b/mascara/src/mascara.js
index 0fc2868e1..1655d1f64 100644
--- a/mascara/src/mascara.js
+++ b/mascara/src/mascara.js
@@ -1,6 +1,6 @@
const Web3 = require('web3')
const setupProvider = require('./lib/setup-provider.js')
-
+const setupDappAutoReload = require('../../app/scripts/lib/auto-reload.js')
const MASCARA_ORIGIN = process.env.MASCARA_ORIGIN || 'http://localhost:9001'
console.log('MASCARA_ORIGIN:', MASCARA_ORIGIN)
@@ -14,8 +14,7 @@ const provider = setupProvider({
instrumentForUserInteractionTriggers(provider)
const web3 = new Web3(provider)
-global.web3 = web3
-
+setupDappAutoReload(web3, provider.publicConfigStore)
//
// ui stuff
//
diff --git a/mascara/src/proxy.js b/mascara/src/proxy.js
index ec5665240..eabc547b4 100644
--- a/mascara/src/proxy.js
+++ b/mascara/src/proxy.js
@@ -20,6 +20,7 @@ background.on('ready', (_) => {
pageStream.pipe(swStream).pipe(pageStream)
})
+background.on('updatefound', () => window.location.reload())
background.on('error', console.error)
background.startWorker()
diff --git a/mascara/src/ui.js b/mascara/src/ui.js
index 2873017cb..5f9be542f 100644
--- a/mascara/src/ui.js
+++ b/mascara/src/ui.js
@@ -24,10 +24,10 @@ const background = new SWcontroller({
fileName: '/background.js',
letBeIdle: false,
intervalDelay,
- wakeUpInterval: 30000
+ wakeUpInterval: 20000
})
// Setup listener for when the service worker is read
-background.on('ready', (readSw) => {
+const connectApp = function (readSw) {
let connectionStream = SwStream({
serviceWorker: background.controller,
context: name,
@@ -39,6 +39,18 @@ background.on('ready', (readSw) => {
if (state.appState.shouldClose) window.close()
})
})
+}
+background.on('ready', (sw) => {
+ background.removeListener('updatefound', connectApp)
+ connectApp(sw)
})
+background.on('updatefound', () => window.location.reload())
+
background.startWorker()
+.then(() => {
+ setTimeout(() => {
+ const appContent = document.getElementById(`app-content`)
+ if (!appContent.children.length) window.location.reload()
+ }, 2000)
+})
console.log('hello from MetaMascara ui!')
diff --git a/mascara/test/helpers.js b/mascara/test/helpers.js
new file mode 100644
index 000000000..eede103b4
--- /dev/null
+++ b/mascara/test/helpers.js
@@ -0,0 +1,7 @@
+function wait(time) {
+ return new Promise(function(resolve, reject) {
+ setTimeout(function() {
+ resolve()
+ }, time * 3 || 1500)
+ })
+}
diff --git a/mascara/test/index.html b/mascara/test/index.html
new file mode 100644
index 000000000..6495c2cfc
--- /dev/null
+++ b/mascara/test/index.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width">
+ <title>QUnit Example</title>
+ <link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.0.0.css">
+</head>
+<body>
+ <div id="qunit"></div>
+ <div id="qunit-fixture"></div>
+ <script src="https://code.jquery.com/qunit/qunit-2.0.0.js"></script>
+ <script src="./jquery-3.1.0.min.js"></script>
+ <script src="./helpers.js"></script>
+ <script src="./test-bundle.js"></script>
+ <script src="/testem.js"></script>
+
+ <div id="app-content"></div>
+ <script src="./bundle.js"></script>
+</body>
+</html>
diff --git a/mascara/test/index.js b/mascara/test/index.js
new file mode 100644
index 000000000..0134cdf00
--- /dev/null
+++ b/mascara/test/index.js
@@ -0,0 +1,22 @@
+var fs = require('fs')
+var path = require('path')
+var browserify = require('browserify');
+var tests = fs.readdirSync(path.join(__dirname, 'lib'))
+var bundlePath = path.join(__dirname, 'test-bundle.js')
+var b = browserify();
+
+// Remove old bundle
+try {
+ fs.unlinkSync(bundlePath)
+} catch (e) {
+ console.error(e)
+}
+
+var writeStream = fs.createWriteStream(bundlePath)
+
+tests.forEach(function(fileName) {
+ b.add(path.join(__dirname, 'lib', fileName))
+})
+
+b.bundle().pipe(writeStream);
+
diff --git a/mascara/test/jquery-3.1.0.min.js b/mascara/test/jquery-3.1.0.min.js
new file mode 100644
index 000000000..f6a6a99e6
--- /dev/null
+++ b/mascara/test/jquery-3.1.0.min.js
@@ -0,0 +1,4 @@
+/*! jQuery v3.1.0 | (c) jQuery Foundation | jquery.org/license */
+!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.0",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null!=a?a<0?this[a+this.length]:this[a]:f.call(this)},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=r.isArray(d)))?(e?(e=!1,f=c&&r.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||"[object Object]"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if("string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"!==c&&!r.isWindow(a)&&("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"label"in b&&b.disabled===a||"form"in b&&b.disabled===a||"form"in b&&b.disabled===!1&&(b.isDisabled===a||b.isDisabled!==!a&&("label"in b||!ea(b))!==a)}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function ra(){}ra.prototype=d.filters=d.pseudos,d.setFilters=new ra,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=Q.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function sa(a){for(var b=0,c=a.length,d="";b<c;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e)}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}}}function ua(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d<e;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i<f;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;e<f;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i<e&&ya(a.slice(i,e)),e<f&&ya(a=a.slice(e)),e<f&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(_,aa),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=V.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(_,aa),$.test(j[0].type)&&qa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&sa(j),!a)return G.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||$.test(a)&&qa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){if(r.isFunction(b))return r.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return r.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(C.test(b))return r.filter(b,a,c);b=r.filter(b,a)}return r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType})}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b<d;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;b<d;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a<c;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&&r(a);if(!A.test(a))for(;d<e;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/\S+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){r.each(b,function(b,c){r.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==r.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return r.each(arguments,function(a,b){var c;while((c=r.inArray(b,f,c))>-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b<f)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&&("object"==typeof a||"function"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,M,e),g(f,c,N,e)):(f++,j.call(a,g(f,c,M,e),g(f,c,N,e),g(f,c,M,c.notifyWith))):(d!==M&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,
+r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h<i;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},T=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function U(){this.expando=r.expando+U.uid++}U.uid=1,U.prototype={cache:function(a){var b=a[this.expando];return b||(b={},T(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){r.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(K)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var V=new U,W=new U,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Y=/[A-Z]/g;function Z(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Y,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c||"false"!==c&&("null"===c?null:+c+""===c?+c:X.test(c)?JSON.parse(c):c)}catch(e){}W.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return W.hasData(a)||V.hasData(a)},data:function(a,b,c){return W.access(a,b,c)},removeData:function(a,b){W.remove(a,b)},_data:function(a,b,c){return V.access(a,b,c)},_removeData:function(a,b){V.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=W.get(f),1===f.nodeType&&!V.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),Z(f,d,e[d])));V.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){W.set(this,a)}):S(this,function(b){var c;if(f&&void 0===b){if(c=W.get(f,a),void 0!==c)return c;if(c=Z(f,a),void 0!==c)return c}else this.each(function(){W.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=r.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=V.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var $=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,_=new RegExp("^(?:([+-])=|)("+$+")([a-z%]*)$","i"),aa=["Top","Right","Bottom","Left"],ba=function(a,b){return a=b||a,"none"===a.style.display||""===a.style.display&&r.contains(a.ownerDocument,a)&&"none"===r.css(a,"display")},ca=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};function da(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return r.css(a,b,"")},i=h(),j=c&&c[3]||(r.cssNumber[b]?"":"px"),k=(r.cssNumber[b]||"px"!==j&&+i)&&_.exec(r.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,r.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var ea={};function fa(a){var b,c=a.ownerDocument,d=a.nodeName,e=ea[d];return e?e:(b=c.body.appendChild(c.createElement(d)),e=r.css(b,"display"),b.parentNode.removeChild(b),"none"===e&&(e="block"),ea[d]=e,e)}function ga(a,b){for(var c,d,e=[],f=0,g=a.length;f<g;f++)d=a[f],d.style&&(c=d.style.display,b?("none"===c&&(e[f]=V.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&&ba(d)&&(e[f]=fa(d))):"none"!==c&&(e[f]="none",V.set(d,"display",c)));for(f=0;f<g;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ga(this,!0)},hide:function(){return ga(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){ba(this)?r(this).show():r(this).hide()})}});var ha=/^(?:checkbox|radio)$/i,ia=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,ja=/^$|\/(?:java|ecma)script/i,ka={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ka.optgroup=ka.option,ka.tbody=ka.tfoot=ka.colgroup=ka.caption=ka.thead,ka.th=ka.td;function la(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function ma(a,b){for(var c=0,d=a.length;c<d;c++)V.set(a[c],"globalEval",!b||V.get(b[c],"globalEval"))}var na=/<|&#?\w+;/;function oa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;n<o;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(na.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ia.exec(f)||["",""])[1].toLowerCase(),i=ka[h]||ka._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=la(l.appendChild(f),"script"),j&&ma(g),c){k=0;while(f=g[k++])ja.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var pa=d.documentElement,qa=/^key/,ra=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,sa=/^([^.]*)(?:\.(.+)|)/;function ta(){return!0}function ua(){return!1}function va(){try{return d.activeElement}catch(a){}}function wa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)wa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ua;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(pa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c<arguments.length;c++)i[c]=arguments[c];if(b.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,b)!==!1){h=r.event.handlers.call(this,b,j),c=0;while((f=h[c++])&&!b.isPropagationStopped()){b.currentTarget=f.elem,d=0;while((g=f.handlers[d++])&&!b.isImmediatePropagationStopped())b.rnamespace&&!b.rnamespace.test(g.namespace)||(b.handleObj=g,b.data=g.data,e=((r.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(b.result=e)===!1&&(b.preventDefault(),b.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,b),b.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!==this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;c<h;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?r(e,this).index(i)>-1:r.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},addProp:function(a,b){Object.defineProperty(r.Event.prototype,a,{enumerable:!0,configurable:!0,get:r.isFunction(b)?function(){if(this.originalEvent)return b(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[a]},set:function(b){Object.defineProperty(this,a,{enumerable:!0,configurable:!0,writable:!0,value:b})}})},fix:function(a){return a[r.expando]?a:new r.Event(a)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==va()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===va()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&r.nodeName(this,"input"))return this.click(),!1},_default:function(a){return r.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},r.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},r.Event=function(a,b){return this instanceof r.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ta:ua,this.target=a.target&&3===a.target.nodeType?a.target.parentNode:a.target,this.currentTarget=a.currentTarget,this.relatedTarget=a.relatedTarget):this.type=a,b&&r.extend(this,b),this.timeStamp=a&&a.timeStamp||r.now(),void(this[r.expando]=!0)):new r.Event(a,b)},r.Event.prototype={constructor:r.Event,isDefaultPrevented:ua,isPropagationStopped:ua,isImmediatePropagationStopped:ua,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ta,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ta,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ta,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},r.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(a){var b=a.button;return null==a.which&&qa.test(a.type)?null!=a.charCode?a.charCode:a.keyCode:!a.which&&void 0!==b&&ra.test(a.type)?1&b?1:2&b?3:4&b?2:0:a.which}},r.event.addProp),r.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){r.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||r.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),r.fn.extend({on:function(a,b,c,d){return wa(this,a,b,c,d)},one:function(a,b,c,d){return wa(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,r(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=ua),this.each(function(){r.event.remove(this,a,c,b)})}});var xa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,ya=/<script|<style|<link/i,za=/checked\s*(?:[^=]|=\s*.checked.)/i,Aa=/^true\/(.*)/,Ba=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Ca(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Da(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ea(a){var b=Aa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Fa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c<d;c++)r.event.add(b,e,j[e][c])}W.hasData(a)&&(h=W.access(a),i=r.extend({},h),W.set(b,i))}}function Ga(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ha.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ha(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&"string"==typeof q&&!o.checkClone&&za.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ha(f,b,c,d)});if(m&&(e=oa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(la(e,"script"),Da),i=h.length;l<m;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,la(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Ea),l=0;l<i;l++)j=h[l],ja.test(j.type||"")&&!V.access(j,"globalEval")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Ba,""),k))}return a}function Ia(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(la(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&ma(la(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(xa,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=la(h),f=la(a),d=0,e=f.length;d<e;d++)Ga(f[d],g[d]);if(b)if(c)for(f=f||la(a),g=g||la(h),d=0,e=f.length;d<e;d++)Fa(f[d],g[d]);else Fa(a,h);return g=la(h,"script"),g.length>0&&ma(g,!i&&la(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ia(this,a,!0)},remove:function(a){return Ia(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.appendChild(a)}})},prepend:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(la(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!ya.test(a)&&!ka[(ia.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c<d;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(la(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ha(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(la(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;g<=f;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var Ja=/^margin/,Ka=new RegExp("^("+$+")(?!px)[a-z%]+$","i"),La=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",pa.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,pa.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&&(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Ma(a,b,c){var d,e,f,g,h=a.style;return c=c||La(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&Ka.test(g)&&Ja.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function Na(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Oa=/^(none|table(?!-c[ea]).+)/,Pa={position:"absolute",visibility:"hidden",display:"block"},Qa={letterSpacing:"0",fontWeight:"400"},Ra=["Webkit","Moz","ms"],Sa=d.createElement("div").style;function Ta(a){if(a in Sa)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ra.length;while(c--)if(a=Ra[c]+b,a in Sa)return a}function Ua(a,b,c){var d=_.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Va(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;f<4;f+=2)"margin"===c&&(g+=r.css(a,c+aa[f],!0,e)),d?("content"===c&&(g-=r.css(a,"padding"+aa[f],!0,e)),"margin"!==c&&(g-=r.css(a,"border"+aa[f]+"Width",!0,e))):(g+=r.css(a,"padding"+aa[f],!0,e),"padding"!==c&&(g+=r.css(a,"border"+aa[f]+"Width",!0,e)));return g}function Wa(a,b,c){var d,e=!0,f=La(a),g="border-box"===r.css(a,"boxSizing",!1,f);if(a.getClientRects().length&&(d=a.getBoundingClientRect()[b]),d<=0||null==d){if(d=Ma(a,b,f),(d<0||null==d)&&(d=a.style[b]),Ka.test(d))return d;e=g&&(o.boxSizingReliable()||d===a.style[b]),d=parseFloat(d)||0}return d+Va(a,b,c||(g?"border":"content"),e,f)+"px"}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ma(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=a.style;return b=r.cssProps[h]||(r.cssProps[h]=Ta(h)||h),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=_.exec(c))&&e[1]&&(c=da(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b);return b=r.cssProps[h]||(r.cssProps[h]=Ta(h)||h),g=r.cssHooks[b]||r.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Ma(a,b,d)),"normal"===e&&b in Qa&&(e=Qa[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){if(c)return!Oa.test(r.css(a,"display"))||a.getClientRects().length&&a.getBoundingClientRect().width?Wa(a,b,d):ca(a,Pa,function(){return Wa(a,b,d)})},set:function(a,c,d){var e,f=d&&La(a),g=d&&Va(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&&(e=_.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=r.css(a,b)),Ua(a,c,g)}}}),r.cssHooks.marginLeft=Na(o.reliableMarginLeft,function(a,b){if(b)return(parseFloat(Ma(a,"marginLeft"))||a.getBoundingClientRect().left-ca(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px"}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];d<4;d++)e[a+aa[d]+b]=f[d]||f[d-2]||f[0];return e}},Ja.test(a)||(r.cssHooks[a+b].set=Ua)}),r.fn.extend({css:function(a,b){return S(this,function(a,b,c){var d,e,f={},g=0;if(r.isArray(b)){for(d=La(a),e=b.length;g<e;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}});function Xa(a,b,c,d,e){return new Xa.prototype.init(a,b,c,d,e)}r.Tween=Xa,Xa.prototype={constructor:Xa,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=Xa.propHooks[this.prop];return a&&a.get?a.get(this):Xa.propHooks._default.get(this)},run:function(a){var b,c=Xa.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Xa.propHooks._default.set(this),this}},Xa.prototype.init.prototype=Xa.prototype,Xa.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Xa.propHooks.scrollTop=Xa.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=Xa.prototype.init,r.fx.step={};var Ya,Za,$a=/^(?:toggle|show|hide)$/,_a=/queueHooks$/;function ab(){Za&&(a.requestAnimationFrame(ab),r.fx.tick())}function bb(){return a.setTimeout(function(){Ya=void 0}),Ya=r.now()}function cb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=aa[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function db(a,b,c){for(var d,e=(gb.tweeners[b]||[]).concat(gb.tweeners["*"]),f=0,g=e.length;f<g;f++)if(d=e[f].call(c,b,a))return d}function eb(a,b,c){var d,e,f,g,h,i,j,k,l="width"in b||"height"in b,m=this,n={},o=a.style,p=a.nodeType&&ba(a),q=V.get(a,"fxshow");c.queue||(g=r._queueHooks(a,"fx"),null==g.unqueued&&(g.unqueued=0,h=g.empty.fire,g.empty.fire=function(){g.unqueued||h()}),g.unqueued++,m.always(function(){m.always(function(){g.unqueued--,r.queue(a,"fx").length||g.empty.fire()})}));for(d in b)if(e=b[d],$a.test(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}n[d]=q&&q[d]||r.style(a,d)}if(i=!r.isEmptyObject(b),i||!r.isEmptyObject(n)){l&&1===a.nodeType&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=q&&q.display,null==j&&(j=V.get(a,"display")),k=r.css(a,"display"),"none"===k&&(j?k=j:(ga([a],!0),j=a.style.display||j,k=r.css(a,"display"),ga([a]))),("inline"===k||"inline-block"===k&&null!=j)&&"none"===r.css(a,"float")&&(i||(m.done(function(){o.display=j}),null==j&&(k=o.display,j="none"===k?"":k)),o.display="inline-block")),c.overflow&&(o.overflow="hidden",m.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]})),i=!1;for(d in n)i||(q?"hidden"in q&&(p=q.hidden):q=V.access(a,"fxshow",{display:j}),f&&(q.hidden=!p),p&&ga([a],!0),m.done(function(){p||ga([a]),V.remove(a,"fxshow");for(d in n)r.style(a,d,n[d])})),i=db(p?q[d]:0,d,m),d in q||(q[d]=i.start,p&&(i.end=i.start,i.start=0))}}function fb(a,b){var c,d,e,f,g;for(c in a)if(d=r.camelCase(c),e=b[d],f=a[c],r.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=r.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function gb(a,b,c){var d,e,f=0,g=gb.prefilters.length,h=r.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Ya||bb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;g<i;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),f<1&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:r.extend({},b),opts:r.extend(!0,{specialEasing:{},easing:r.easing._default},c),originalProperties:b,originalOptions:c,startTime:Ya||bb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=r.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;c<d;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(fb(k,j.opts.specialEasing);f<g;f++)if(d=gb.prefilters[f].call(j,a,k,j.opts))return r.isFunction(d.stop)&&(r._queueHooks(j.elem,j.opts.queue).stop=r.proxy(d.stop,d)),d;return r.map(k,db,j),r.isFunction(j.opts.start)&&j.opts.start.call(a,j),r.fx.timer(r.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}r.Animation=r.extend(gb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return da(c.elem,a,_.exec(b),c),c}]},tweener:function(a,b){r.isFunction(a)?(b=a,a=["*"]):a=a.match(K);for(var c,d=0,e=a.length;d<e;d++)c=a[d],gb.tweeners[c]=gb.tweeners[c]||[],gb.tweeners[c].unshift(b)},prefilters:[eb],prefilter:function(a,b){b?gb.prefilters.unshift(a):gb.prefilters.push(a)}}),r.speed=function(a,b,c){var e=a&&"object"==typeof a?r.extend({},a):{complete:c||!c&&b||r.isFunction(a)&&a,duration:a,easing:c&&b||b&&!r.isFunction(b)&&b};return r.fx.off||d.hidden?e.duration=0:e.duration="number"==typeof e.duration?e.duration:e.duration in r.fx.speeds?r.fx.speeds[e.duration]:r.fx.speeds._default,null!=e.queue&&e.queue!==!0||(e.queue="fx"),e.old=e.complete,e.complete=function(){r.isFunction(e.old)&&e.old.call(this),e.queue&&r.dequeue(this,e.queue)},e},r.fn.extend({fadeTo:function(a,b,c,d){return this.filter(ba).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=r.isEmptyObject(a),f=r.speed(b,c,d),g=function(){var b=gb(this,r.extend({},a),f);(e||V.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=r.timers,g=V.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&_a.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||r.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=V.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=r.timers,g=d?d.length:0;for(c.finish=!0,r.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;b<g;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),r.each(["toggle","show","hide"],function(a,b){var c=r.fn[b];r.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(cb(b,!0),a,d,e)}}),r.each({slideDown:cb("show"),slideUp:cb("hide"),slideToggle:cb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){r.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),r.timers=[],r.fx.tick=function(){var a,b=0,c=r.timers;for(Ya=r.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||r.fx.stop(),Ya=void 0},r.fx.timer=function(a){r.timers.push(a),a()?r.fx.start():r.timers.pop()},r.fx.interval=13,r.fx.start=function(){Za||(Za=a.requestAnimationFrame?a.requestAnimationFrame(ab):a.setInterval(r.fx.tick,r.fx.interval))},r.fx.stop=function(){a.cancelAnimationFrame?a.cancelAnimationFrame(Za):a.clearInterval(Za),Za=null},r.fx.speeds={slow:600,fast:200,_default:400},r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",o.checkOn=""!==a.value,o.optSelected=c.selected,a=d.createElement("input"),a.value="t",a.type="radio",o.radioValue="t"===a.value}();var hb,ib=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return S(this,r.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?hb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K);
+if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),hb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ib[b]||r.find.attr;ib[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=ib[g],ib[g]=e,e=null!=c(a,b,d)?g:null,ib[g]=f),e}});var jb=/^(?:input|select|textarea|button)$/i,kb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):jb.test(a.nodeName)||kb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});var lb=/[\t\r\n\f]/g;function mb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,mb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,mb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,mb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=mb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+mb(c)+" ").replace(lb," ").indexOf(b)>-1)return!0;return!1}});var nb=/\r/g,ob=/[\x20\t\r\n\f]+/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(nb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:r.trim(r.text(a)).replace(ob," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type,g=f?null:[],h=f?e+1:d.length,i=e<0?h:f?e:0;i<h;i++)if(c=d[i],(c.selected||i===e)&&!c.disabled&&(!c.parentNode.disabled||!r.nodeName(c.parentNode,"optgroup"))){if(b=r(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(r.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var tb=/\[\]$/,ub=/\r?\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)xb(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ha.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,"\r\n")}}):{name:b.name,value:c.replace(ub,"\r\n")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\/\//,Fb={},Gb={},Hb="*/".concat("*"),Ib=d.createElement("a");Ib.href=qb.href;function Jb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Nb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+"").replace(Eb,qb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(K)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+"//"+Ib.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(yb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,""),n=(sb.test(f)?"&":"?")+"_="+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Hb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&"withCredentials"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;if(o.cors||Pb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Qb=[],Rb=/(=)\?(?=&|$)|\?\?/;r.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Qb.pop()||r.expando+"_"+rb++;return this[a]=!0,a}}),r.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Rb.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Rb.test(b.data)&&"data");if(h||"jsonp"===b.dataTypes[0])return e=b.jsonpCallback=r.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Rb,"$1"+e):b.jsonp!==!1&&(b.url+=(sb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||r.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?r(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Qb.push(e)),g&&r.isFunction(f)&&f(g[0]),g=f=void 0}),"script"}),o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument("").body;return a.innerHTML="<form></form><form></form>",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if("string"!=typeof a)return[];"boolean"==typeof b&&(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(""),e=b.createElement("base"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=B.exec(a),g=!c&&[],f?[b.createElement(f[1])]:(f=oa([a],b,g),g&&g.length&&r(g).remove(),r.merge([],f.childNodes))},r.fn.load=function(a,b,c){var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=r.trim(a.slice(h)),a=a.slice(0,h)),r.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&r.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?r("<div>").append(r.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},r.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){r.fn[b]=function(a){return this.on(b,a)}}),r.expr.pseudos.animated=function(a){return r.grep(r.timers,function(b){return a===b.elem}).length};function Sb(a){return r.isWindow(a)?a:9===a.nodeType&&a.defaultView}r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,"position"),l=r(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=r.css(a,"top"),i=r.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),r.isFunction(b)&&(b=b.call(a,c,r.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),d.width||d.height?(e=f.ownerDocument,c=Sb(e),b=e.documentElement,{top:d.top+c.pageYOffset-b.clientTop,left:d.left+c.pageXOffset-b.clientLeft}):d):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===r.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),r.nodeName(a[0],"html")||(d=a.offset()),d={top:d.top+r.css(a[0],"borderTopWidth",!0),left:d.left+r.css(a[0],"borderLeftWidth",!0)}),{top:b.top-d.top-r.css(c,"marginTop",!0),left:b.left-d.left-r.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===r.css(a,"position"))a=a.offsetParent;return a||pa})}}),r.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;r.fn[a]=function(d){return S(this,function(a,d,e){var f=Sb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each(["top","left"],function(a,b){r.cssHooks[b]=Na(o.pixelPosition,function(a,c){if(c)return c=Ma(a,b),Ka.test(c)?r(a).position()[b]+"px":c})}),r.each({Height:"height",Width:"width"},function(a,b){r.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&&(c||"boolean"!=typeof e),h=c||(e===!0||f===!0?"margin":"border");return S(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf("outer")?b["inner"+a]:b.document.documentElement["client"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body["scroll"+a],f["scroll"+a],b.body["offset"+a],f["offset"+a],f["client"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),r.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}}),r.parseJSON=JSON.parse,"function"==typeof define&&define.amd&&define("jquery",[],function(){return r});var Tb=a.jQuery,Ub=a.$;return r.noConflict=function(b){return a.$===r&&(a.$=Ub),b&&a.jQuery===r&&(a.jQuery=Tb),r},b||(a.jQuery=a.$=r),r});
diff --git a/mascara/test/lib/first-time.js b/mascara/test/lib/first-time.js
new file mode 100644
index 000000000..e42c9e39d
--- /dev/null
+++ b/mascara/test/lib/first-time.js
@@ -0,0 +1,119 @@
+const PASSWORD = 'password123'
+
+QUnit.module('first time usage')
+
+QUnit.test('render init screen', function (assert) {
+ var done = assert.async()
+ let app
+
+ wait(1000).then(function() {
+ app = $('#app-content').contents()
+ const recurseNotices = function () {
+ let button = app.find('button')
+ if (button.html() === 'Accept') {
+ let termsPage = app.find('.markdown')[0]
+ termsPage.scrollTop = termsPage.scrollHeight
+ return wait().then(() => {
+ button.click()
+ return wait()
+ }).then(() => {
+ return recurseNotices()
+ })
+ } else {
+ return wait()
+ }
+ }
+ return recurseNotices()
+ }).then(function() {
+ // Scroll through terms
+ var title = app.find('h1').text()
+ assert.equal(title, 'MetaMask', 'title screen')
+
+ // enter password
+ var pwBox = app.find('#password-box')[0]
+ var confBox = app.find('#password-box-confirm')[0]
+ pwBox.value = PASSWORD
+ confBox.value = PASSWORD
+
+ return wait()
+ }).then(function() {
+
+ // create vault
+ var createButton = app.find('button.primary')[0]
+ createButton.click()
+
+ return wait(1500)
+ }).then(function() {
+
+ var created = app.find('h3')[0]
+ assert.equal(created.textContent, 'Vault Created', 'Vault created screen')
+
+ // Agree button
+ var button = app.find('button')[0]
+ assert.ok(button, 'button present')
+ button.click()
+
+ return wait(1000)
+ }).then(function() {
+
+ var detail = app.find('.account-detail-section')[0]
+ assert.ok(detail, 'Account detail section loaded.')
+
+ var sandwich = app.find('.sandwich-expando')[0]
+ sandwich.click()
+
+ return wait()
+ }).then(function() {
+
+ var sandwich = app.find('.menu-droppo')[0]
+ var children = sandwich.children
+ var lock = children[children.length - 2]
+ assert.ok(lock, 'Lock menu item found')
+ lock.click()
+
+ return wait(1000)
+ }).then(function() {
+
+ var pwBox = app.find('#password-box')[0]
+ pwBox.value = PASSWORD
+
+ var createButton = app.find('button.primary')[0]
+ createButton.click()
+
+ return wait(1000)
+ }).then(function() {
+
+ var detail = app.find('.account-detail-section')[0]
+ assert.ok(detail, 'Account detail section loaded again.')
+
+ return wait()
+ }).then(function (){
+
+ var qrButton = app.find('.fa.fa-qrcode')[0]
+ qrButton.click()
+
+ return wait(1000)
+ }).then(function (){
+
+ var qrHeader = app.find('.qr-header')[0]
+ var qrContainer = app.find('#qr-container')[0]
+ assert.equal(qrHeader.textContent, 'Account 1', 'Should show account label.')
+ assert.ok(qrContainer, 'QR Container found')
+
+ return wait()
+ }).then(function (){
+
+ var networkMenu = app.find('.network-indicator')[0]
+ networkMenu.click()
+
+ return wait()
+ }).then(function (){
+
+ var networkMenu = app.find('.network-indicator')[0]
+ var children = networkMenu.children
+ children.length[3]
+ assert.ok(children, 'All network options present')
+
+ done()
+ })
+})
diff --git a/mascara/test/testem.yml b/mascara/test/testem.yml
new file mode 100644
index 000000000..f1f5844bd
--- /dev/null
+++ b/mascara/test/testem.yml
@@ -0,0 +1,13 @@
+launch_in_dev:
+ - Chrome
+ - Firefox
+ - Opera
+launch_in_ci:
+ - Chrome
+ - Firefox
+ - Opera
+framework:
+ - qunit
+before_tests: "npm run mascaraCi"
+after_tests: "rm ./background.js ./test-bundle.js ./bundle.js"
+test_page: "./index.html"
diff --git a/mascara/test/util/mascara-test-helper.js b/mascara/test/util/mascara-test-helper.js
new file mode 100644
index 000000000..9cf4fa900
--- /dev/null
+++ b/mascara/test/util/mascara-test-helper.js
@@ -0,0 +1,40 @@
+const EventEmitter = require('events')
+const IDB = require('idb-global')
+const KEY = 'metamask-test-config'
+module.exports = class Helper extends EventEmitter {
+ constructor () {
+ super()
+ }
+
+ tryToCleanContext () {
+ this.unregister()
+ .then(() => this.clearDb())
+ .then(() => super.emit('complete'))
+ .catch((err) => super.emit('complete'))
+ }
+
+ unregister () {
+ return global.navigator.serviceWorker.getRegistration()
+ .then((registration) => {
+ if (registration) return registration.unregister()
+ .then((b) => b ? Promise.resolve() : Promise.reject())
+ else return Promise.resolve()
+ })
+ }
+ clearDb () {
+ return new Promise ((resolve, reject) => {
+ const deleteRequest = global.indexDB.deleteDatabase(KEY)
+ deleteRequest.addEventListener('success', resolve)
+ deleteRequest.addEventListener('error', reject)
+ })
+
+ }
+ mockState (state) {
+ const db = new IDB({
+ version: 2,
+ key: KEY,
+ initialState: state
+ })
+ return db.open()
+ }
+}
diff --git a/mascara/test/window-load.js b/mascara/test/window-load.js
new file mode 100644
index 000000000..d3f44f05f
--- /dev/null
+++ b/mascara/test/window-load.js
@@ -0,0 +1,5 @@
+const Helper = require('./util/mascara-test-helper.js')
+
+window.addEventListener('load', () => {
+ require('../src/ui.js')
+})
diff --git a/mascara/ui/index.html b/mascara/ui/index.html
index c5eeb05ef..eac8e4898 100644
--- a/mascara/ui/index.html
+++ b/mascara/ui/index.html
@@ -2,7 +2,8 @@
<html>
<head>
<meta charset="utf-8">
- <title>MetaMask Plugin</title>
+ <title>MetaMascara Alpha</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="app-content"></div>
diff --git a/notices/archive/notice_1.md b/notices/archive/notice_1.md
deleted file mode 100644
index 488b60cc9..000000000
--- a/notices/archive/notice_1.md
+++ /dev/null
@@ -1 +0,0 @@
-MetaMask now lists a new network on our dropdown list: Kovan, a [Proof of Authority](https://github.com/paritytech/parity/wiki/Proof-of-Authority-Chains) testchain managed by several blockchain organizations such as Digix, Etherscan, and Parity. It is designed to be a more stable and reliable testnet alternative to Ropsten and was created in response to recent attacks that slowed down the Ropsten network. You can read more about Kovan [here](https://medium.com/@Digix/announcing-kovan-a-stable-ethereum-public-testnet-10ac7cb6c85f#.6o8sz8cct) and [here](https://medium.com/@Digix/letter-from-the-ceo-some-context-regarding-kovan-7b5121adb901#.kfv7zhw83). As with Ropsten, the default remote node to connect to Kovan is managed by Infura.
diff --git a/notices/archive/notice_2.md b/notices/archive/notice_2.md
new file mode 100644
index 000000000..76e9bd8fb
--- /dev/null
+++ b/notices/archive/notice_2.md
@@ -0,0 +1,8 @@
+MetaMask is beta software.
+
+When you log in to MetaMask, your current account is visible to every new site you visit.
+
+For your privacy, for now, please sign out of MetaMask when you're done using a site.
+
+Also, by default, you will be signed in to a test network. To use real Ether, you must connect to the main network manually in the top left network menu.
+
diff --git a/notices/notice-nonce.json b/notices/notice-nonce.json
index d8263ee98..e440e5c84 100644
--- a/notices/notice-nonce.json
+++ b/notices/notice-nonce.json
@@ -1 +1 @@
-2 \ No newline at end of file
+3 \ No newline at end of file
diff --git a/notices/notices.json b/notices/notices.json
index 5503c7855..e7f74c925 100644
--- a/notices/notices.json
+++ b/notices/notices.json
@@ -1 +1 @@
-[{"read":false,"date":"Thu Feb 09 2017","title":"Terms of Use","body":"# Terms of Use #\n\n**THIS AGREEMENT IS SUBJECT TO BINDING ARBITRATION AND A WAIVER OF CLASS ACTION RIGHTS AS DETAILED IN SECTION 13. PLEASE READ THE AGREEMENT CAREFULLY.**\n\n_Our Terms of Use have been updated as of September 5, 2016_\n\n## 1. Acceptance of Terms ##\n\nMetaMask provides a platform for managing Ethereum (or \"ETH\") accounts, and allowing ordinary websites to interact with the Ethereum blockchain, while keeping the user in control over what transactions they approve, through our website located at[ ](http://metamask.io)[https://metamask.io/](https://metamask.io/) and browser plugin (the \"Site\") — which includes text, images, audio, code and other materials (collectively, the “Content”) and all of the features, and services provided. The Site, and any other features, tools, materials, or other services offered from time to time by MetaMask are referred to here as the “Service.” Please read these Terms of Use (the “Terms” or “Terms of Use”) carefully before using the Service. By using or otherwise accessing the Services, or clicking to accept or agree to these Terms where that option is made available, you (1) accept and agree to these Terms (2) consent to the collection, use, disclosure and other handling of information as described in our Privacy Policy and (3) any additional terms, rules and conditions of participation issued by MetaMask from time to time. If you do not agree to the Terms, then you may not access or use the Content or Services.\n\n## 2. Modification of Terms of Use ##\n\nExcept for Section 13, providing for binding arbitration and waiver of class action rights, MetaMask reserves the right, at its sole discretion, to modify or replace the Terms of Use at any time. The most current version of these Terms will be posted on our Site. You shall be responsible for reviewing and becoming familiar with any such modifications. Use of the Services by you after any modification to the Terms constitutes your acceptance of the Terms of Use as modified.\n\n\n\n## 3. Eligibility ##\n\nYou hereby represent and warrant that you are fully able and competent to enter into the terms, conditions, obligations, affirmations, representations and warranties set forth in these Terms and to abide by and comply with these Terms.\n\nMetaMask is a global platform and by accessing the Content or Services, you are representing and warranting that, you are of the legal age of majority in your jurisdiction as is required to access such Services and Content and enter into arrangements as provided by the Service. You further represent that you are otherwise legally permitted to use the service in your jurisdiction including owning cryptographic tokens of value, and interacting with the Services or Content in any way. You further represent you are responsible for ensuring compliance with the laws of your jurisdiction and acknowledge that MetaMask is not liable for your compliance with such laws.\n\n## 4 Account Password and Security ##\n\nWhen setting up an account within MetaMask, you will be responsible for keeping your own account secrets, which may be a twelve-word seed phrase, an account file, or other locally stored secret information. MetaMask encrypts this information locally with a password you provide, that we never send to our servers. You agree to (a) never use the same password for MetaMask that you have ever used outside of this service; (b) keep your secret information and password confidential and do not share them with anyone else; (c) immediately notify MetaMask of any unauthorized use of your account or breach of security. MetaMask cannot and will not be liable for any loss or damage arising from your failure to comply with this section.\n\n## 5. Representations, Warranties, and Risks ##\n\n### 5.1. Warranty Disclaimer ###\n\nYou expressly understand and agree that your use of the Service is at your sole risk. The Service (including the Service and the Content) are provided on an \"AS IS\" and \"as available\" basis, without warranties of any kind, either express or implied, including, without limitation, implied warranties of merchantability, fitness for a particular purpose or non-infringement. You acknowledge that MetaMask has no control over, and no duty to take any action regarding: which users gain access to or use the Service; what effects the Content may have on you; how you may interpret or use the Content; or what actions you may take as a result of having been exposed to the Content. You release MetaMask from all liability for you having acquired or not acquired Content through the Service. MetaMask makes no representations concerning any Content contained in or accessed through the Service, and MetaMask will not be responsible or liable for the accuracy, copyright compliance, legality or decency of material contained in or accessed through the Service.\n\n### 5.2 Sophistication and Risk of Cryptographic Systems ###\n\nBy utilizing the Service or interacting with the Content or platform in any way, you represent that you understand the inherent risks associated with cryptographic systems; and warrant that you have an understanding of the usage and intricacies of native cryptographic tokens, like Ether (ETH) and Bitcoin (BTC), smart contract based tokens such as those that follow the Ethereum Token Standard (https://github.com/ethereum/EIPs/issues/20), and blockchain-based software systems.\n\n### 5.3 Risk of Regulatory Actions in One or More Jurisdictions ###\n\nMetaMask and ETH could be impacted by one or more regulatory inquiries or regulatory action, which could impede or limit the ability of MetaMask to continue to develop, or which could impede or limit your ability to access or use the Service or Ethereum blockchain.\n\n### 5.4 Risk of Weaknesses or Exploits in the Field of Cryptography ###\n\nYou acknowledge and understand that Cryptography is a progressing field. Advances in code cracking or technical advances such as the development of quantum computers may present risks to cryptocurrencies and Services of Content, which could result in the theft or loss of your cryptographic tokens or property. To the extent possible, MetaMask intends to update the protocol underlying Services to account for any advances in cryptography and to incorporate additional security measures, but does not guarantee or otherwise represent full security of the system. By using the Service or accessing Content, you acknowledge these inherent risks.\n\n### 5.5 Volatility of Crypto Currencies ###\n\nYou understand that Ethereum and other blockchain technologies and associated currencies or tokens are highly volatile due to many factors including but not limited to adoption, speculation, technology and security risks. You also acknowledge that the cost of transacting on such technologies is variable and may increase at any time causing impact to any activities taking place on the Ethereum blockchain. You acknowledge these risks and represent that MetaMask cannot be held liable for such fluctuations or increased costs.\n\n### 5.6 Application Security ###\n\nYou acknowledge that Ethereum applications are code subject to flaws and acknowledge that you are solely responsible for evaluating any code provided by the Services or Content and the trustworthiness of any third-party websites, products, smart-contracts, or Content you access or use through the Service. You further expressly acknowledge and represent that Ethereum applications can be written maliciously or negligently, that MetaMask cannot be held liable for your interaction with such applications and that such applications may cause the loss of property or even identity. This warning and others later provided by MetaMask in no way evidence or represent an on-going duty to alert you to all of the potential risks of utilizing the Service or Content.\n\n## 6. Indemnity ##\n\nYou agree to release and to indemnify, defend and hold harmless MetaMask and its parents, subsidiaries, affiliates and agencies, as well as the officers, directors, employees, shareholders and representatives of any of the foregoing entities, from and against any and all losses, liabilities, expenses, damages, costs (including attorneys’ fees and court costs) claims or actions of any kind whatsoever arising or resulting from your use of the Service, your violation of these Terms of Use, and any of your acts or omissions that implicate publicity rights, defamation or invasion of privacy. MetaMask reserves the right, at its own expense, to assume exclusive defense and control of any matter otherwise subject to indemnification by you and, in such case, you agree to cooperate with MetaMask in the defense of such matter.\n\n## 7. Limitation on liability ##\n\nYOU ACKNOWLEDGE AND AGREE THAT YOU ASSUME FULL RESPONSIBILITY FOR YOUR USE OF THE SITE AND SERVICE. YOU ACKNOWLEDGE AND AGREE THAT ANY INFORMATION YOU SEND OR RECEIVE DURING YOUR USE OF THE SITE AND SERVICE MAY NOT BE SECURE AND MAY BE INTERCEPTED OR LATER ACQUIRED BY UNAUTHORIZED PARTIES. YOU ACKNOWLEDGE AND AGREE THAT YOUR USE OF THE SITE AND SERVICE IS AT YOUR OWN RISK. RECOGNIZING SUCH, YOU UNDERSTAND AND AGREE THAT, TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, NEITHER METAMASK NOR ITS SUPPLIERS OR LICENSORS WILL BE LIABLE TO YOU FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY OR OTHER DAMAGES OF ANY KIND, INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF PROFITS, GOODWILL, USE, DATA OR OTHER TANGIBLE OR INTANGIBLE LOSSES OR ANY OTHER DAMAGES BASED ON CONTRACT, TORT, STRICT LIABILITY OR ANY OTHER THEORY (EVEN IF METAMASK HAD BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES), RESULTING FROM THE SITE OR SERVICE; THE USE OR THE INABILITY TO USE THE SITE OR SERVICE; UNAUTHORIZED ACCESS TO OR ALTERATION OF YOUR TRANSMISSIONS OR DATA; STATEMENTS OR CONDUCT OF ANY THIRD PARTY ON THE SITE OR SERVICE; ANY ACTIONS WE TAKE OR FAIL TO TAKE AS A RESULT OF COMMUNICATIONS YOU SEND TO US; HUMAN ERRORS; TECHNICAL MALFUNCTIONS; FAILURES, INCLUDING PUBLIC UTILITY OR TELEPHONE OUTAGES; OMISSIONS, INTERRUPTIONS, LATENCY, DELETIONS OR DEFECTS OF ANY DEVICE OR NETWORK, PROVIDERS, OR SOFTWARE (INCLUDING, BUT NOT LIMITED TO, THOSE THAT DO NOT PERMIT PARTICIPATION IN THE SERVICE); ANY INJURY OR DAMAGE TO COMPUTER EQUIPMENT; INABILITY TO FULLY ACCESS THE SITE OR SERVICE OR ANY OTHER WEBSITE; THEFT, TAMPERING, DESTRUCTION, OR UNAUTHORIZED ACCESS TO, IMAGES OR OTHER CONTENT OF ANY KIND; DATA THAT IS PROCESSED LATE OR INCORRECTLY OR IS INCOMPLETE OR LOST; TYPOGRAPHICAL, PRINTING OR OTHER ERRORS, OR ANY COMBINATION THEREOF; OR ANY OTHER MATTER RELATING TO THE SITE OR SERVICE.\n\nSOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF CERTAIN WARRANTIES OR THE LIMITATION OR EXCLUSION OF LIABILITY FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES. ACCORDINGLY, SOME OF THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU.\n\n## 8. Our Proprietary Rights ##\n\nAll title, ownership and intellectual property rights in and to the Service are owned by MetaMask or its licensors. You acknowledge and agree that the Service contains proprietary and confidential information that is protected by applicable intellectual property and other laws. Except as expressly authorized by MetaMask, you agree not to copy, modify, rent, lease, loan, sell, distribute, perform, display or create derivative works based on the Service, in whole or in part. MetaMask issues a license for MetaMask, found [here](https://github.com/MetaMask/metamask-plugin/blob/master/LICENSE). For information on other licenses utilized in the development of MetaMask, please see our attribution page at: [https://metamask.io/attributions.html](https://metamask.io/attributions.html)\n\n## 9. Links ##\n\nThe Service provides, or third parties may provide, links to other World Wide Web or accessible sites, applications or resources. Because MetaMask has no control over such sites, applications and resources, you acknowledge and agree that MetaMask is not responsible for the availability of such external sites, applications or resources, and does not endorse and is not responsible or liable for any content, advertising, products or other materials on or available from such sites or resources. You further acknowledge and agree that MetaMask shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods or services available on or through any such site or resource.\n\n## 10. Termination and Suspension ##\n\nMetaMask may terminate or suspend all or part of the Service and your MetaMask access immediately, without prior notice or liability, if you breach any of the terms or conditions of the Terms. Upon termination of your access, your right to use the Service will immediately cease.\n\nThe following provisions of the Terms survive any termination of these Terms: INDEMNITY; WARRANTY DISCLAIMERS; LIMITATION ON LIABILITY; OUR PROPRIETARY RIGHTS; LINKS; TERMINATION; NO THIRD PARTY BENEFICIARIES; BINDING ARBITRATION AND CLASS ACTION WAIVER; GENERAL INFORMATION.\n\n## 11. No Third Party Beneficiaries ##\n\nYou agree that, except as otherwise expressly provided in these Terms, there shall be no third party beneficiaries to the Terms.\n\n## 12. Notice and Procedure For Making Claims of Copyright Infringement ##\n\nIf you believe that your copyright or the copyright of a person on whose behalf you are authorized to act has been infringed, please provide MetaMask’s Copyright Agent a written Notice containing the following information:\n\n· an electronic or physical signature of the person authorized to act on behalf of the owner of the copyright or other intellectual property interest;\n\n· a description of the copyrighted work or other intellectual property that you claim has been infringed;\n\n· a description of where the material that you claim is infringing is located on the Service;\n\n· your address, telephone number, and email address;\n\n· a statement by you that you have a good faith belief that the disputed use is not authorized by the copyright owner, its agent, or the law;\n\n· a statement by you, made under penalty of perjury, that the above information in your Notice is accurate and that you are the copyright or intellectual property owner or authorized to act on the copyright or intellectual property owner's behalf.\n\nMetaMask’s Copyright Agent can be reached at:\n\nEmail: copyright [at] metamask [dot] io\n\nMail:\n\nAttention:\n\nMetaMask Copyright ℅ ConsenSys\n\n49 Bogart Street\n\nBrooklyn, NY 11206\n\n## 13. Binding Arbitration and Class Action Waiver ##\n\nPLEASE READ THIS SECTION CAREFULLY – IT MAY SIGNIFICANTLY AFFECT YOUR LEGAL RIGHTS, INCLUDING YOUR RIGHT TO FILE A LAWSUIT IN COURT\n\n### 13.1 Initial Dispute Resolution ###\n\nThe parties shall use their best efforts to engage directly to settle any dispute, claim, question, or disagreement and engage in good faith negotiations which shall be a condition to either party initiating a lawsuit or arbitration.\n\n### 13.2 Binding Arbitration ###\n\nIf the parties do not reach an agreed upon solution within a period of 30 days from the time informal dispute resolution under the Initial Dispute Resolution provision begins, then either party may initiate binding arbitration as the sole means to resolve claims, subject to the terms set forth below. Specifically, all claims arising out of or relating to these Terms (including their formation, performance and breach), the parties’ relationship with each other and/or your use of the Service shall be finally settled by binding arbitration administered by the American Arbitration Association in accordance with the provisions of its Commercial Arbitration Rules and the supplementary procedures for consumer related disputes of the American Arbitration Association (the \"AAA\"), excluding any rules or procedures governing or permitting class actions.\n\nThe arbitrator, and not any federal, state or local court or agency, shall have exclusive authority to resolve all disputes arising out of or relating to the interpretation, applicability, enforceability or formation of these Terms, including, but not limited to any claim that all or any part of these Terms are void or voidable, or whether a claim is subject to arbitration. The arbitrator shall be empowered to grant whatever relief would be available in a court under law or in equity. The arbitrator’s award shall be written, and binding on the parties and may be entered as a judgment in any court of competent jurisdiction.\n\nThe parties understand that, absent this mandatory provision, they would have the right to sue in court and have a jury trial. They further understand that, in some instances, the costs of arbitration could exceed the costs of litigation and the right to discovery may be more limited in arbitration than in court.\n\n### 13.3 Location ###\n\nBinding arbitration shall take place in New York. You agree to submit to the personal jurisdiction of any federal or state court in New York County, New York, in order to compel arbitration, to stay proceedings pending arbitration, or to confirm, modify, vacate or enter judgment on the award entered by the arbitrator.\n\n### 13.4 Class Action Waiver ###\n\nThe parties further agree that any arbitration shall be conducted in their individual capacities only and not as a class action or other representative action, and the parties expressly waive their right to file a class action or seek relief on a class basis. YOU AND METAMASK AGREE THAT EACH MAY BRING CLAIMS AGAINST THE OTHER ONLY IN YOUR OR ITS INDIVIDUAL CAPACITY, AND NOT AS A PLAINTIFF OR CLASS MEMBER IN ANY PURPORTED CLASS OR REPRESENTATIVE PROCEEDING. If any court or arbitrator determines that the class action waiver set forth in this paragraph is void or unenforceable for any reason or that an arbitration can proceed on a class basis, then the arbitration provision set forth above shall be deemed null and void in its entirety and the parties shall be deemed to have not agreed to arbitrate disputes.\n\n### 13.5 Exception - Litigation of Intellectual Property and Small Claims Court Claims ###\n\nNotwithstanding the parties' decision to resolve all disputes through arbitration, either party may bring an action in state or federal court to protect its intellectual property rights (\"intellectual property rights\" means patents, copyrights, moral rights, trademarks, and trade secrets, but not privacy or publicity rights). Either party may also seek relief in a small claims court for disputes or claims within the scope of that court’s jurisdiction.\n\n### 13.6 30-Day Right to Opt Out ###\n\nYou have the right to opt-out and not be bound by the arbitration and class action waiver provisions set forth above by sending written notice of your decision to opt-out to the following address: MetaMask ℅ ConsenSys, 49 Bogart Street, Brooklyn NY 11206 and via email at legal-opt@metamask.io. The notice must be sent within 30 days of September 6, 2016 or your first use of the Service, whichever is later, otherwise you shall be bound to arbitrate disputes in accordance with the terms of those paragraphs. If you opt-out of these arbitration provisions, MetaMask also will not be bound by them.\n\n### 13.7 Changes to This Section ###\n\nMetaMask will provide 60-days’ notice of any changes to this section. Changes will become effective on the 60th day, and will apply prospectively only to any claims arising after the 60th day.\n\nFor any dispute not subject to arbitration you and MetaMask agree to submit to the personal and exclusive jurisdiction of and venue in the federal and state courts located in New York, New York. You further agree to accept service of process by mail, and hereby waive any and all jurisdictional and venue defenses otherwise available.\n\nThe Terms and the relationship between you and MetaMask shall be governed by the laws of the State of New York without regard to conflict of law provisions.\n\n## 14. General Information ##\n\n### 14.1 Entire Agreement ###\n\nThese Terms (and any additional terms, rules and conditions of participation that MetaMask may post on the Service) constitute the entire agreement between you and MetaMask with respect to the Service and supersedes any prior agreements, oral or written, between you and MetaMask. In the event of a conflict between these Terms and the additional terms, rules and conditions of participation, the latter will prevail over the Terms to the extent of the conflict.\n\n### 14.2 Waiver and Severability of Terms ###\n\nThe failure of MetaMask to exercise or enforce any right or provision of the Terms shall not constitute a waiver of such right or provision. If any provision of the Terms is found by an arbitrator or court of competent jurisdiction to be invalid, the parties nevertheless agree that the arbitrator or court should endeavor to give effect to the parties' intentions as reflected in the provision, and the other provisions of the Terms remain in full force and effect.\n\n### 14.3 Statute of Limitations ###\n\nYou agree that regardless of any statute or law to the contrary, any claim or cause of action arising out of or related to the use of the Service or the Terms must be filed within one (1) year after such claim or cause of action arose or be forever barred.\n\n### 14.4 Section Titles ###\n\nThe section titles in the Terms are for convenience only and have no legal or contractual effect.\n\n### 14.5 Communications ###\n\nUsers with questions, complaints or claims with respect to the Service may contact us using the relevant contact information set forth above and at communications@metamask.io.\n\n## 15 Related Links ##\n\n**[Terms of Use](https://metamask.io/terms.html)**\n\n**[Privacy](https://metamask.io/privacy.html)**\n\n**[Attributions](https://metamask.io/attributions.html)**\n\n","id":0},{"read":false,"date":"Wed Mar 22 2017","title":"Announcing Kovan Support","body":"MetaMask now lists a new network on our dropdown list: Kovan, a [Proof of Authority](https://github.com/paritytech/parity/wiki/Proof-of-Authority-Chains) testchain managed by several blockchain organizations such as Digix, Etherscan, and Parity. It is designed to be a more stable and reliable testnet alternative to Ropsten and was created in response to recent attacks that slowed down the Ropsten network. You can read more about Kovan [here](https://medium.com/@Digix/announcing-kovan-a-stable-ethereum-public-testnet-10ac7cb6c85f#.6o8sz8cct) and [here](https://medium.com/@Digix/letter-from-the-ceo-some-context-regarding-kovan-7b5121adb901#.kfv7zhw83). As with Ropsten, the default remote node to connect to Kovan is managed by Infura.\n","id":1}] \ No newline at end of file
+[{"read":false,"date":"Thu Feb 09 2017","title":"Terms of Use","body":"# Terms of Use #\n\n**THIS AGREEMENT IS SUBJECT TO BINDING ARBITRATION AND A WAIVER OF CLASS ACTION RIGHTS AS DETAILED IN SECTION 13. PLEASE READ THE AGREEMENT CAREFULLY.**\n\n_Our Terms of Use have been updated as of September 5, 2016_\n\n## 1. Acceptance of Terms ##\n\nMetaMask provides a platform for managing Ethereum (or \"ETH\") accounts, and allowing ordinary websites to interact with the Ethereum blockchain, while keeping the user in control over what transactions they approve, through our website located at[ ](http://metamask.io)[https://metamask.io/](https://metamask.io/) and browser plugin (the \"Site\") — which includes text, images, audio, code and other materials (collectively, the “Content”) and all of the features, and services provided. The Site, and any other features, tools, materials, or other services offered from time to time by MetaMask are referred to here as the “Service.” Please read these Terms of Use (the “Terms” or “Terms of Use”) carefully before using the Service. By using or otherwise accessing the Services, or clicking to accept or agree to these Terms where that option is made available, you (1) accept and agree to these Terms (2) consent to the collection, use, disclosure and other handling of information as described in our Privacy Policy and (3) any additional terms, rules and conditions of participation issued by MetaMask from time to time. If you do not agree to the Terms, then you may not access or use the Content or Services.\n\n## 2. Modification of Terms of Use ##\n\nExcept for Section 13, providing for binding arbitration and waiver of class action rights, MetaMask reserves the right, at its sole discretion, to modify or replace the Terms of Use at any time. The most current version of these Terms will be posted on our Site. You shall be responsible for reviewing and becoming familiar with any such modifications. Use of the Services by you after any modification to the Terms constitutes your acceptance of the Terms of Use as modified.\n\n\n\n## 3. Eligibility ##\n\nYou hereby represent and warrant that you are fully able and competent to enter into the terms, conditions, obligations, affirmations, representations and warranties set forth in these Terms and to abide by and comply with these Terms.\n\nMetaMask is a global platform and by accessing the Content or Services, you are representing and warranting that, you are of the legal age of majority in your jurisdiction as is required to access such Services and Content and enter into arrangements as provided by the Service. You further represent that you are otherwise legally permitted to use the service in your jurisdiction including owning cryptographic tokens of value, and interacting with the Services or Content in any way. You further represent you are responsible for ensuring compliance with the laws of your jurisdiction and acknowledge that MetaMask is not liable for your compliance with such laws.\n\n## 4 Account Password and Security ##\n\nWhen setting up an account within MetaMask, you will be responsible for keeping your own account secrets, which may be a twelve-word seed phrase, an account file, or other locally stored secret information. MetaMask encrypts this information locally with a password you provide, that we never send to our servers. You agree to (a) never use the same password for MetaMask that you have ever used outside of this service; (b) keep your secret information and password confidential and do not share them with anyone else; (c) immediately notify MetaMask of any unauthorized use of your account or breach of security. MetaMask cannot and will not be liable for any loss or damage arising from your failure to comply with this section.\n\n## 5. Representations, Warranties, and Risks ##\n\n### 5.1. Warranty Disclaimer ###\n\nYou expressly understand and agree that your use of the Service is at your sole risk. The Service (including the Service and the Content) are provided on an \"AS IS\" and \"as available\" basis, without warranties of any kind, either express or implied, including, without limitation, implied warranties of merchantability, fitness for a particular purpose or non-infringement. You acknowledge that MetaMask has no control over, and no duty to take any action regarding: which users gain access to or use the Service; what effects the Content may have on you; how you may interpret or use the Content; or what actions you may take as a result of having been exposed to the Content. You release MetaMask from all liability for you having acquired or not acquired Content through the Service. MetaMask makes no representations concerning any Content contained in or accessed through the Service, and MetaMask will not be responsible or liable for the accuracy, copyright compliance, legality or decency of material contained in or accessed through the Service.\n\n### 5.2 Sophistication and Risk of Cryptographic Systems ###\n\nBy utilizing the Service or interacting with the Content or platform in any way, you represent that you understand the inherent risks associated with cryptographic systems; and warrant that you have an understanding of the usage and intricacies of native cryptographic tokens, like Ether (ETH) and Bitcoin (BTC), smart contract based tokens such as those that follow the Ethereum Token Standard (https://github.com/ethereum/EIPs/issues/20), and blockchain-based software systems.\n\n### 5.3 Risk of Regulatory Actions in One or More Jurisdictions ###\n\nMetaMask and ETH could be impacted by one or more regulatory inquiries or regulatory action, which could impede or limit the ability of MetaMask to continue to develop, or which could impede or limit your ability to access or use the Service or Ethereum blockchain.\n\n### 5.4 Risk of Weaknesses or Exploits in the Field of Cryptography ###\n\nYou acknowledge and understand that Cryptography is a progressing field. Advances in code cracking or technical advances such as the development of quantum computers may present risks to cryptocurrencies and Services of Content, which could result in the theft or loss of your cryptographic tokens or property. To the extent possible, MetaMask intends to update the protocol underlying Services to account for any advances in cryptography and to incorporate additional security measures, but does not guarantee or otherwise represent full security of the system. By using the Service or accessing Content, you acknowledge these inherent risks.\n\n### 5.5 Volatility of Crypto Currencies ###\n\nYou understand that Ethereum and other blockchain technologies and associated currencies or tokens are highly volatile due to many factors including but not limited to adoption, speculation, technology and security risks. You also acknowledge that the cost of transacting on such technologies is variable and may increase at any time causing impact to any activities taking place on the Ethereum blockchain. You acknowledge these risks and represent that MetaMask cannot be held liable for such fluctuations or increased costs.\n\n### 5.6 Application Security ###\n\nYou acknowledge that Ethereum applications are code subject to flaws and acknowledge that you are solely responsible for evaluating any code provided by the Services or Content and the trustworthiness of any third-party websites, products, smart-contracts, or Content you access or use through the Service. You further expressly acknowledge and represent that Ethereum applications can be written maliciously or negligently, that MetaMask cannot be held liable for your interaction with such applications and that such applications may cause the loss of property or even identity. This warning and others later provided by MetaMask in no way evidence or represent an on-going duty to alert you to all of the potential risks of utilizing the Service or Content.\n\n## 6. Indemnity ##\n\nYou agree to release and to indemnify, defend and hold harmless MetaMask and its parents, subsidiaries, affiliates and agencies, as well as the officers, directors, employees, shareholders and representatives of any of the foregoing entities, from and against any and all losses, liabilities, expenses, damages, costs (including attorneys’ fees and court costs) claims or actions of any kind whatsoever arising or resulting from your use of the Service, your violation of these Terms of Use, and any of your acts or omissions that implicate publicity rights, defamation or invasion of privacy. MetaMask reserves the right, at its own expense, to assume exclusive defense and control of any matter otherwise subject to indemnification by you and, in such case, you agree to cooperate with MetaMask in the defense of such matter.\n\n## 7. Limitation on liability ##\n\nYOU ACKNOWLEDGE AND AGREE THAT YOU ASSUME FULL RESPONSIBILITY FOR YOUR USE OF THE SITE AND SERVICE. YOU ACKNOWLEDGE AND AGREE THAT ANY INFORMATION YOU SEND OR RECEIVE DURING YOUR USE OF THE SITE AND SERVICE MAY NOT BE SECURE AND MAY BE INTERCEPTED OR LATER ACQUIRED BY UNAUTHORIZED PARTIES. YOU ACKNOWLEDGE AND AGREE THAT YOUR USE OF THE SITE AND SERVICE IS AT YOUR OWN RISK. RECOGNIZING SUCH, YOU UNDERSTAND AND AGREE THAT, TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, NEITHER METAMASK NOR ITS SUPPLIERS OR LICENSORS WILL BE LIABLE TO YOU FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY OR OTHER DAMAGES OF ANY KIND, INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF PROFITS, GOODWILL, USE, DATA OR OTHER TANGIBLE OR INTANGIBLE LOSSES OR ANY OTHER DAMAGES BASED ON CONTRACT, TORT, STRICT LIABILITY OR ANY OTHER THEORY (EVEN IF METAMASK HAD BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES), RESULTING FROM THE SITE OR SERVICE; THE USE OR THE INABILITY TO USE THE SITE OR SERVICE; UNAUTHORIZED ACCESS TO OR ALTERATION OF YOUR TRANSMISSIONS OR DATA; STATEMENTS OR CONDUCT OF ANY THIRD PARTY ON THE SITE OR SERVICE; ANY ACTIONS WE TAKE OR FAIL TO TAKE AS A RESULT OF COMMUNICATIONS YOU SEND TO US; HUMAN ERRORS; TECHNICAL MALFUNCTIONS; FAILURES, INCLUDING PUBLIC UTILITY OR TELEPHONE OUTAGES; OMISSIONS, INTERRUPTIONS, LATENCY, DELETIONS OR DEFECTS OF ANY DEVICE OR NETWORK, PROVIDERS, OR SOFTWARE (INCLUDING, BUT NOT LIMITED TO, THOSE THAT DO NOT PERMIT PARTICIPATION IN THE SERVICE); ANY INJURY OR DAMAGE TO COMPUTER EQUIPMENT; INABILITY TO FULLY ACCESS THE SITE OR SERVICE OR ANY OTHER WEBSITE; THEFT, TAMPERING, DESTRUCTION, OR UNAUTHORIZED ACCESS TO, IMAGES OR OTHER CONTENT OF ANY KIND; DATA THAT IS PROCESSED LATE OR INCORRECTLY OR IS INCOMPLETE OR LOST; TYPOGRAPHICAL, PRINTING OR OTHER ERRORS, OR ANY COMBINATION THEREOF; OR ANY OTHER MATTER RELATING TO THE SITE OR SERVICE.\n\nSOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF CERTAIN WARRANTIES OR THE LIMITATION OR EXCLUSION OF LIABILITY FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES. ACCORDINGLY, SOME OF THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU.\n\n## 8. Our Proprietary Rights ##\n\nAll title, ownership and intellectual property rights in and to the Service are owned by MetaMask or its licensors. You acknowledge and agree that the Service contains proprietary and confidential information that is protected by applicable intellectual property and other laws. Except as expressly authorized by MetaMask, you agree not to copy, modify, rent, lease, loan, sell, distribute, perform, display or create derivative works based on the Service, in whole or in part. MetaMask issues a license for MetaMask, found [here](https://github.com/MetaMask/metamask-plugin/blob/master/LICENSE). For information on other licenses utilized in the development of MetaMask, please see our attribution page at: [https://metamask.io/attributions.html](https://metamask.io/attributions.html)\n\n## 9. Links ##\n\nThe Service provides, or third parties may provide, links to other World Wide Web or accessible sites, applications or resources. Because MetaMask has no control over such sites, applications and resources, you acknowledge and agree that MetaMask is not responsible for the availability of such external sites, applications or resources, and does not endorse and is not responsible or liable for any content, advertising, products or other materials on or available from such sites or resources. You further acknowledge and agree that MetaMask shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods or services available on or through any such site or resource.\n\n## 10. Termination and Suspension ##\n\nMetaMask may terminate or suspend all or part of the Service and your MetaMask access immediately, without prior notice or liability, if you breach any of the terms or conditions of the Terms. Upon termination of your access, your right to use the Service will immediately cease.\n\nThe following provisions of the Terms survive any termination of these Terms: INDEMNITY; WARRANTY DISCLAIMERS; LIMITATION ON LIABILITY; OUR PROPRIETARY RIGHTS; LINKS; TERMINATION; NO THIRD PARTY BENEFICIARIES; BINDING ARBITRATION AND CLASS ACTION WAIVER; GENERAL INFORMATION.\n\n## 11. No Third Party Beneficiaries ##\n\nYou agree that, except as otherwise expressly provided in these Terms, there shall be no third party beneficiaries to the Terms.\n\n## 12. Notice and Procedure For Making Claims of Copyright Infringement ##\n\nIf you believe that your copyright or the copyright of a person on whose behalf you are authorized to act has been infringed, please provide MetaMask’s Copyright Agent a written Notice containing the following information:\n\n· an electronic or physical signature of the person authorized to act on behalf of the owner of the copyright or other intellectual property interest;\n\n· a description of the copyrighted work or other intellectual property that you claim has been infringed;\n\n· a description of where the material that you claim is infringing is located on the Service;\n\n· your address, telephone number, and email address;\n\n· a statement by you that you have a good faith belief that the disputed use is not authorized by the copyright owner, its agent, or the law;\n\n· a statement by you, made under penalty of perjury, that the above information in your Notice is accurate and that you are the copyright or intellectual property owner or authorized to act on the copyright or intellectual property owner's behalf.\n\nMetaMask’s Copyright Agent can be reached at:\n\nEmail: copyright [at] metamask [dot] io\n\nMail:\n\nAttention:\n\nMetaMask Copyright ℅ ConsenSys\n\n49 Bogart Street\n\nBrooklyn, NY 11206\n\n## 13. Binding Arbitration and Class Action Waiver ##\n\nPLEASE READ THIS SECTION CAREFULLY – IT MAY SIGNIFICANTLY AFFECT YOUR LEGAL RIGHTS, INCLUDING YOUR RIGHT TO FILE A LAWSUIT IN COURT\n\n### 13.1 Initial Dispute Resolution ###\n\nThe parties shall use their best efforts to engage directly to settle any dispute, claim, question, or disagreement and engage in good faith negotiations which shall be a condition to either party initiating a lawsuit or arbitration.\n\n### 13.2 Binding Arbitration ###\n\nIf the parties do not reach an agreed upon solution within a period of 30 days from the time informal dispute resolution under the Initial Dispute Resolution provision begins, then either party may initiate binding arbitration as the sole means to resolve claims, subject to the terms set forth below. Specifically, all claims arising out of or relating to these Terms (including their formation, performance and breach), the parties’ relationship with each other and/or your use of the Service shall be finally settled by binding arbitration administered by the American Arbitration Association in accordance with the provisions of its Commercial Arbitration Rules and the supplementary procedures for consumer related disputes of the American Arbitration Association (the \"AAA\"), excluding any rules or procedures governing or permitting class actions.\n\nThe arbitrator, and not any federal, state or local court or agency, shall have exclusive authority to resolve all disputes arising out of or relating to the interpretation, applicability, enforceability or formation of these Terms, including, but not limited to any claim that all or any part of these Terms are void or voidable, or whether a claim is subject to arbitration. The arbitrator shall be empowered to grant whatever relief would be available in a court under law or in equity. The arbitrator’s award shall be written, and binding on the parties and may be entered as a judgment in any court of competent jurisdiction.\n\nThe parties understand that, absent this mandatory provision, they would have the right to sue in court and have a jury trial. They further understand that, in some instances, the costs of arbitration could exceed the costs of litigation and the right to discovery may be more limited in arbitration than in court.\n\n### 13.3 Location ###\n\nBinding arbitration shall take place in New York. You agree to submit to the personal jurisdiction of any federal or state court in New York County, New York, in order to compel arbitration, to stay proceedings pending arbitration, or to confirm, modify, vacate or enter judgment on the award entered by the arbitrator.\n\n### 13.4 Class Action Waiver ###\n\nThe parties further agree that any arbitration shall be conducted in their individual capacities only and not as a class action or other representative action, and the parties expressly waive their right to file a class action or seek relief on a class basis. YOU AND METAMASK AGREE THAT EACH MAY BRING CLAIMS AGAINST THE OTHER ONLY IN YOUR OR ITS INDIVIDUAL CAPACITY, AND NOT AS A PLAINTIFF OR CLASS MEMBER IN ANY PURPORTED CLASS OR REPRESENTATIVE PROCEEDING. If any court or arbitrator determines that the class action waiver set forth in this paragraph is void or unenforceable for any reason or that an arbitration can proceed on a class basis, then the arbitration provision set forth above shall be deemed null and void in its entirety and the parties shall be deemed to have not agreed to arbitrate disputes.\n\n### 13.5 Exception - Litigation of Intellectual Property and Small Claims Court Claims ###\n\nNotwithstanding the parties' decision to resolve all disputes through arbitration, either party may bring an action in state or federal court to protect its intellectual property rights (\"intellectual property rights\" means patents, copyrights, moral rights, trademarks, and trade secrets, but not privacy or publicity rights). Either party may also seek relief in a small claims court for disputes or claims within the scope of that court’s jurisdiction.\n\n### 13.6 30-Day Right to Opt Out ###\n\nYou have the right to opt-out and not be bound by the arbitration and class action waiver provisions set forth above by sending written notice of your decision to opt-out to the following address: MetaMask ℅ ConsenSys, 49 Bogart Street, Brooklyn NY 11206 and via email at legal-opt@metamask.io. The notice must be sent within 30 days of September 6, 2016 or your first use of the Service, whichever is later, otherwise you shall be bound to arbitrate disputes in accordance with the terms of those paragraphs. If you opt-out of these arbitration provisions, MetaMask also will not be bound by them.\n\n### 13.7 Changes to This Section ###\n\nMetaMask will provide 60-days’ notice of any changes to this section. Changes will become effective on the 60th day, and will apply prospectively only to any claims arising after the 60th day.\n\nFor any dispute not subject to arbitration you and MetaMask agree to submit to the personal and exclusive jurisdiction of and venue in the federal and state courts located in New York, New York. You further agree to accept service of process by mail, and hereby waive any and all jurisdictional and venue defenses otherwise available.\n\nThe Terms and the relationship between you and MetaMask shall be governed by the laws of the State of New York without regard to conflict of law provisions.\n\n## 14. General Information ##\n\n### 14.1 Entire Agreement ###\n\nThese Terms (and any additional terms, rules and conditions of participation that MetaMask may post on the Service) constitute the entire agreement between you and MetaMask with respect to the Service and supersedes any prior agreements, oral or written, between you and MetaMask. In the event of a conflict between these Terms and the additional terms, rules and conditions of participation, the latter will prevail over the Terms to the extent of the conflict.\n\n### 14.2 Waiver and Severability of Terms ###\n\nThe failure of MetaMask to exercise or enforce any right or provision of the Terms shall not constitute a waiver of such right or provision. If any provision of the Terms is found by an arbitrator or court of competent jurisdiction to be invalid, the parties nevertheless agree that the arbitrator or court should endeavor to give effect to the parties' intentions as reflected in the provision, and the other provisions of the Terms remain in full force and effect.\n\n### 14.3 Statute of Limitations ###\n\nYou agree that regardless of any statute or law to the contrary, any claim or cause of action arising out of or related to the use of the Service or the Terms must be filed within one (1) year after such claim or cause of action arose or be forever barred.\n\n### 14.4 Section Titles ###\n\nThe section titles in the Terms are for convenience only and have no legal or contractual effect.\n\n### 14.5 Communications ###\n\nUsers with questions, complaints or claims with respect to the Service may contact us using the relevant contact information set forth above and at communications@metamask.io.\n\n## 15 Related Links ##\n\n**[Terms of Use](https://metamask.io/terms.html)**\n\n**[Privacy](https://metamask.io/privacy.html)**\n\n**[Attributions](https://metamask.io/attributions.html)**\n\n","id":0},{"read":false,"date":"Mon May 08 2017","title":"Privacy Notice","body":"MetaMask is beta software. \n\nWhen you log in to MetaMask, your current account is visible to every new site you visit.\n\nFor your privacy, for now, please sign out of MetaMask when you're done using a site.\n\nAlso, by default, you will be signed in to a test network. To use real Ether, you must connect to the main network manually in the top left network menu.\n\n","id":2}] \ No newline at end of file
diff --git a/package.json b/package.json
index 2eaaf7154..07f2c488c 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"start": "npm run dev",
"dev": "gulp dev --debug",
"disc": "gulp disc --debug",
- "dist": "gulp dist --disableLiveReload",
+ "dist": "npm install && gulp dist --disableLiveReload",
"test": "npm run lint && npm run test-unit && npm run test-integration",
"test-unit": "METAMASK_ENV=test mocha --require test/helper.js --recursive \"test/unit/**/*.js\"",
"test-integration": "npm run buildMock && npm run buildCiUnits && testem ci -P 2",
@@ -21,7 +21,12 @@
"testem": "npm run buildMock && testem",
"announce": "node development/announcer.js",
"generateNotice": "node notices/notice-generator.js",
- "deleteNotice": "node notices/notice-delete.js"
+ "deleteNotice": "node notices/notice-delete.js",
+ "mascara": "node ./mascara/example/server",
+ "buildMascaraCi": "browserify mascara/test/window-load.js -o mascara/test/bundle.js",
+ "buildMascaraSWCi": "browserify mascara/src/background.js -o mascara/test/background.js",
+ "mascaraCi": "npm run buildMascaraCi && npm run buildMascaraSWCi && node mascara/test/index.js",
+ "testMascara": "cd mascara/test && npm run mascaraCi && testem ci -P 3"
},
"browserify": {
"transform": [
@@ -29,7 +34,8 @@
"babelify",
{
"presets": [
- "es2015"
+ "es2015",
+ "stage-0"
]
}
],
@@ -39,36 +45,39 @@
},
"dependencies": {
"async": "^1.5.2",
- "async-q": "^0.3.1",
+ "babel-runtime": "^6.23.0",
"bip39": "^2.2.0",
"bluebird": "^3.5.0",
"browser-passworder": "^2.0.3",
"browserify-derequire": "^0.9.4",
- "client-sw-ready-event": "^3.0.1",
+ "client-sw-ready-event": "^3.3.0",
"clone": "^1.0.2",
"copy-to-clipboard": "^2.0.0",
"debounce": "^1.0.0",
"deep-extend": "^0.4.1",
"denodeify": "^1.2.1",
+ "detect-node": "^2.0.3",
"disc": "^1.3.2",
"dnode": "^1.2.2",
"end-of-stream": "^1.1.0",
"ensnare": "^1.0.0",
"eth-bin-to-ops": "^1.0.1",
+ "eth-contract-metadata": "^1.0.0",
"eth-hd-keyring": "^1.1.1",
- "eth-query": "^1.0.3",
+ "eth-query": "^2.1.1",
"eth-sig-util": "^1.1.1",
"eth-simple-keyring": "^1.1.1",
"eth-token-tracker": "^1.0.4",
- "ethereumjs-tx": "^1.2.5",
+ "ethereumjs-tx": "^1.3.0",
"ethereumjs-util": "ethereumjs/ethereumjs-util#ac5d0908536b447083ea422b435da27f26615de9",
"ethereumjs-wallet": "^0.6.0",
- "ethjs-ens": "^1.0.2",
+ "ethjs-ens": "^2.0.0",
"express": "^4.14.0",
"extension-link-enabler": "^1.0.0",
"extensionizer": "^1.0.0",
"gulp-eslint": "^2.0.0",
"hat": "0.0.3",
+ "idb-global": "^1.0.0",
"identicon.js": "^1.2.1",
"iframe": "^1.0.0",
"iframe-stream": "^1.0.2",
@@ -80,6 +89,7 @@
"mississippi": "^1.2.0",
"mkdirp": "^0.5.1",
"multiplex": "^6.7.0",
+ "number-to-bn": "^1.7.0",
"obs-store": "^2.3.1",
"once": "^1.3.3",
"ping-pong-stream": "^1.0.0",
@@ -114,7 +124,7 @@
"valid-url": "^1.0.9",
"vreme": "^3.0.2",
"web3": "0.18.2",
- "web3-provider-engine": "^11.0.2",
+ "web3-provider-engine": "^12.2.4",
"web3-stream-provider": "^2.0.6",
"xtend": "^4.0.1"
},
@@ -135,6 +145,9 @@
"deep-freeze-strict": "^1.1.1",
"del": "^2.2.0",
"envify": "^4.0.0",
+ "enzyme": "^2.8.2",
+ "eslint-plugin-chai": "0.0.1",
+ "eslint-plugin-mocha": "^4.9.0",
"fs-promise": "^1.0.0",
"gulp": "github:gulpjs/gulp#4.0",
"gulp-if": "^2.0.1",
@@ -159,6 +172,10 @@
"prompt": "^1.0.0",
"qs": "^6.2.0",
"qunit": "^0.9.1",
+ "react-addons-test-utils": "^15.5.1",
+ "react-dom": "^15.5.4",
+ "react-test-renderer": "^15.5.4",
+ "react-testutils-additions": "^15.2.0",
"sinon": "^1.17.3",
"tape": "^4.5.1",
"testem": "^1.10.3",
diff --git a/test/helper.js b/test/helper.js
index aaac7580e..1c5934a89 100644
--- a/test/helper.js
+++ b/test/helper.js
@@ -20,14 +20,12 @@ window.localStorage = {}
if (!window.crypto) window.crypto = {}
if (!window.crypto.getRandomValues) window.crypto.getRandomValues = require('polyfill-crypto.getrandomvalues')
-
-
-function enableFailureOnUnhandledPromiseRejection() {
+function enableFailureOnUnhandledPromiseRejection () {
// overwrite node's promise with the stricter Bluebird promise
global.Promise = require('bluebird')
// modified from https://github.com/mochajs/mocha/issues/1926#issuecomment-180842722
-
+
// rethrow unhandledRejections
if (typeof process !== 'undefined') {
process.on('unhandledRejection', function (reason) {
@@ -51,4 +49,4 @@ function enableFailureOnUnhandledPromiseRejection() {
typeof (console.error || console.log) === 'function') {
(console.error || console.log)('Unhandled rejections will be ignored!')
}
-} \ No newline at end of file
+}
diff --git a/test/integration/helpers.js b/test/integration/helpers.js
index eede103b4..10cd74e64 100644
--- a/test/integration/helpers.js
+++ b/test/integration/helpers.js
@@ -1,6 +1,6 @@
function wait(time) {
- return new Promise(function(resolve, reject) {
- setTimeout(function() {
+ return new Promise(function (resolve, reject) {
+ setTimeout(function () {
resolve()
}, time * 3 || 1500)
})
diff --git a/test/integration/index.js b/test/integration/index.js
index ff6d1baf8..f2d656b0b 100644
--- a/test/integration/index.js
+++ b/test/integration/index.js
@@ -1,10 +1,10 @@
var fs = require('fs')
var path = require('path')
-var browserify = require('browserify');
+var browserify = require('browserify')
var tests = fs.readdirSync(path.join(__dirname, 'lib'))
var bundlePath = path.join(__dirname, 'bundle.js')
-var b = browserify();
+var b = browserify()
// Remove old bundle
try {
@@ -13,9 +13,9 @@ try {
var writeStream = fs.createWriteStream(bundlePath)
-tests.forEach(function(fileName) {
+tests.forEach(function (fileName) {
b.add(path.join(__dirname, 'lib', fileName))
})
-b.bundle().pipe(writeStream);
+b.bundle().pipe(writeStream)
diff --git a/test/integration/lib/first-time.js b/test/integration/lib/first-time.js
index dbb88a3da..6c8cedbac 100644
--- a/test/integration/lib/first-time.js
+++ b/test/integration/lib/first-time.js
@@ -11,7 +11,7 @@ QUnit.test('render init screen', function (assert) {
const recurseNotices = function () {
let button = app.find('button')
- if (button.html() === 'Continue') {
+ if (button.html() === 'Accept') {
let termsPage = app.find('.markdown')[0]
termsPage.scrollTop = termsPage.scrollHeight
return wait().then(() => {
diff --git a/test/lib/migrations/001.json b/test/lib/migrations/001.json
index 2fe6dd836..7bd55a50e 100644
--- a/test/lib/migrations/001.json
+++ b/test/lib/migrations/001.json
@@ -1 +1,14 @@
-{"version":0,"data":{"wallet":"{\"encSeed\":{\"encStr\":\"rT1C1jjkFRfmrwefscFcwZohl4f+HfIFlBZ9AM4ZD8atJmfKDIQCVK11NYDKYv8ZMIY03f3t8MuoZvfzBL8IJsWnZUhpzVTNNiARQJD2WpGA19eNBzgZm4vd0GwkIUruUDeJXu0iv2j9wU8hOQUqPbOePPy2Am5ro97iuvMAroRTnEKD60qFVg==\",\"nonce\":\"YUY2mwNq2v3FV0Fi94QnSiKFOLYfDR95\"},\"ksData\":{\"m/44'/60'/0'/0\":{\"info\":{\"curve\":\"secp256k1\",\"purpose\":\"sign\"},\"encHdPathPriv\":{\"encStr\":\"Iyi7ft4JQ9UtwrSXRT6ZIHPtZqJhe99rh0uWhNc6QLan6GanY2ZQeU0tt76CBealEWJyrJReSxGQdqDmSDYjpjH3m4JO5l0DfPLPseCqzXV/W+dzM0ubJ8lztLwpwi0L+vULNMqCx4dQtoNbNBq1QZUnjtpm6O8mWpScspboww==\",\"nonce\":\"Z7RqtjNjC6FrLUj5wVW1+HkjOW6Hib6K\"},\"hdIndex\":3,\"encPrivKeys\":{\"edb81c10122f34040cc4bef719a272fbbb1cf897\":{\"key\":\"8ab81tKBd4+CLAbzvS7SBFRTd6VWXBs86uBE43lgcmBu2U7UB22xdH64Q2hUf9eB\",\"nonce\":\"aGUEqI033FY39zKjWmZSI6PQrCLvkiRP\"},\"8bd7d5c000cf05284e98356370dc5ccaa3dbfc38\":{\"key\":\"+i3wmf4b+B898QtlOBfL0Ixirjg59/LLPX61vQ2L0xRPjXzNog0O4Wn15RemM5mY\",\"nonce\":\"imKrlkuoC5uuFkzJBbuDBluGCPJXNTKm\"},\"2340695474656e3124b8eba1172fbfb00eeac8f8\":{\"key\":\"pi+H9D8LYKsdCQKrfaJtsGFjE+X9s74xN675tsoIKrbPXhtpxMLOIQVtSqYveF62\",\"nonce\":\"49g80wDTovHwbguVVYf2FsYbp7Db5OAR\"}},\"addresses\":[\"edb81c10122f34040cc4bef719a272fbbb1cf897\",\"8bd7d5c000cf05284e98356370dc5ccaa3dbfc38\",\"2340695474656e3124b8eba1172fbfb00eeac8f8\"]}},\"version\":2}","config":{"provider":{"type":"etherscan"}}},"meta":{"version":0}} \ No newline at end of file
+{
+ "version": 0,
+ "data": {
+ "wallet": "{\"encSeed\":{\"encStr\":\"rT1C1jjkFRfmrwefscFcwZohl4f+HfIFlBZ9AM4ZD8atJmfKDIQCVK11NYDKYv8ZMIY03f3t8MuoZvfzBL8IJsWnZUhpzVTNNiARQJD2WpGA19eNBzgZm4vd0GwkIUruUDeJXu0iv2j9wU8hOQUqPbOePPy2Am5ro97iuvMAroRTnEKD60qFVg==\",\"nonce\":\"YUY2mwNq2v3FV0Fi94QnSiKFOLYfDR95\"},\"ksData\":{\"m/44'/60'/0'/0\":{\"info\":{\"curve\":\"secp256k1\",\"purpose\":\"sign\"},\"encHdPathPriv\":{\"encStr\":\"Iyi7ft4JQ9UtwrSXRT6ZIHPtZqJhe99rh0uWhNc6QLan6GanY2ZQeU0tt76CBealEWJyrJReSxGQdqDmSDYjpjH3m4JO5l0DfPLPseCqzXV/W+dzM0ubJ8lztLwpwi0L+vULNMqCx4dQtoNbNBq1QZUnjtpm6O8mWpScspboww==\",\"nonce\":\"Z7RqtjNjC6FrLUj5wVW1+HkjOW6Hib6K\"},\"hdIndex\":3,\"encPrivKeys\":{\"edb81c10122f34040cc4bef719a272fbbb1cf897\":{\"key\":\"8ab81tKBd4+CLAbzvS7SBFRTd6VWXBs86uBE43lgcmBu2U7UB22xdH64Q2hUf9eB\",\"nonce\":\"aGUEqI033FY39zKjWmZSI6PQrCLvkiRP\"},\"8bd7d5c000cf05284e98356370dc5ccaa3dbfc38\":{\"key\":\"+i3wmf4b+B898QtlOBfL0Ixirjg59/LLPX61vQ2L0xRPjXzNog0O4Wn15RemM5mY\",\"nonce\":\"imKrlkuoC5uuFkzJBbuDBluGCPJXNTKm\"},\"2340695474656e3124b8eba1172fbfb00eeac8f8\":{\"key\":\"pi+H9D8LYKsdCQKrfaJtsGFjE+X9s74xN675tsoIKrbPXhtpxMLOIQVtSqYveF62\",\"nonce\":\"49g80wDTovHwbguVVYf2FsYbp7Db5OAR\"}},\"addresses\":[\"edb81c10122f34040cc4bef719a272fbbb1cf897\",\"8bd7d5c000cf05284e98356370dc5ccaa3dbfc38\",\"2340695474656e3124b8eba1172fbfb00eeac8f8\"]}},\"version\":2}",
+ "config": {
+ "provider": {
+ "type": "etherscan"
+ }
+ }
+ },
+ "meta": {
+ "version": 0
+ }
+} \ No newline at end of file
diff --git a/test/lib/mock-config-manager.js b/test/lib/mock-config-manager.js
index 72be86ed1..0cc6953bb 100644
--- a/test/lib/mock-config-manager.js
+++ b/test/lib/mock-config-manager.js
@@ -2,9 +2,8 @@ const ObservableStore = require('obs-store')
const clone = require('clone')
const ConfigManager = require('../../app/scripts/lib/config-manager')
const firstTimeState = require('../../app/scripts/first-time-state')
-const STORAGE_KEY = 'metamask-config'
-module.exports = function() {
- let store = new ObservableStore(clone(firstTimeState))
+module.exports = function () {
+ const store = new ObservableStore(clone(firstTimeState))
return new ConfigManager({ store })
-} \ No newline at end of file
+}
diff --git a/test/lib/mock-encryptor.js b/test/lib/mock-encryptor.js
index 09bbf7ad5..cdf13c507 100644
--- a/test/lib/mock-encryptor.js
+++ b/test/lib/mock-encryptor.js
@@ -4,28 +4,28 @@ let cacheVal
module.exports = {
- encrypt(password, dataObj) {
+ encrypt (password, dataObj) {
cacheVal = dataObj
return Promise.resolve(mockHex)
},
- decrypt(password, text) {
+ decrypt (password, text) {
return Promise.resolve(cacheVal || {})
},
- encryptWithKey(key, dataObj) {
+ encryptWithKey (key, dataObj) {
return this.encrypt(key, dataObj)
},
- decryptWithKey(key, text) {
+ decryptWithKey (key, text) {
return this.decrypt(key, text)
},
- keyFromPassword(password) {
+ keyFromPassword (password) {
return Promise.resolve(mockKey)
},
- generateSalt() {
+ generateSalt () {
return 'WHADDASALT!'
},
diff --git a/test/lib/mock-simple-keychain.js b/test/lib/mock-simple-keychain.js
index 615b3e537..d3addc3e8 100644
--- a/test/lib/mock-simple-keychain.js
+++ b/test/lib/mock-simple-keychain.js
@@ -6,32 +6,32 @@ const type = 'Simple Key Pair'
module.exports = class MockSimpleKeychain {
- static type() { return type }
+ static type () { return type }
- constructor(opts) {
+ constructor (opts) {
this.type = type
this.opts = opts || {}
this.wallets = []
}
- serialize() {
+ serialize () {
return [ fakeWallet.privKey ]
}
- deserialize(data) {
+ deserialize (data) {
if (!Array.isArray(data)) {
throw new Error('Simple keychain deserialize requires a privKey array.')
}
this.wallets = [ fakeWallet ]
}
- addAccounts(n = 1) {
- for(var i = 0; i < n; i++) {
+ addAccounts (n = 1) {
+ for (var i = 0; i < n; i++) {
this.wallets.push(fakeWallet)
}
}
- getAccounts() {
+ getAccounts () {
return this.wallets.map(w => w.address)
}
diff --git a/test/lib/mock-store.js b/test/lib/mock-store.js
new file mode 100644
index 000000000..0d50e2d9c
--- /dev/null
+++ b/test/lib/mock-store.js
@@ -0,0 +1,18 @@
+const createStore = require('redux').createStore
+const applyMiddleware = require('redux').applyMiddleware
+const thunkMiddleware = require('redux-thunk')
+const createLogger = require('redux-logger')
+const rootReducer = function () {}
+
+module.exports = configureStore
+
+const loggerMiddleware = createLogger()
+
+const createStoreWithMiddleware = applyMiddleware(
+ thunkMiddleware,
+ loggerMiddleware
+)(createStore)
+
+function configureStore (initialState) {
+ return createStoreWithMiddleware(rootReducer, initialState)
+}
diff --git a/test/unit/account-link-test.js b/test/unit/account-link-test.js
index 803a70f37..47a961d1f 100644
--- a/test/unit/account-link-test.js
+++ b/test/unit/account-link-test.js
@@ -1,18 +1,16 @@
var assert = require('assert')
var linkGen = require('../../ui/lib/account-link')
-describe('account-link', function() {
-
- it('adds ropsten prefix to ropsten test network', function() {
+describe('account-link', function () {
+ it('adds ropsten prefix to ropsten test network', function () {
var result = linkGen('account', '3')
assert.notEqual(result.indexOf('ropsten'), -1, 'ropsten included')
assert.notEqual(result.indexOf('account'), -1, 'account included')
})
- it('adds kovan prefix to kovan test network', function() {
+ it('adds kovan prefix to kovan test network', function () {
var result = linkGen('account', '42')
assert.notEqual(result.indexOf('kovan'), -1, 'kovan included')
assert.notEqual(result.indexOf('account'), -1, 'account included')
})
-
})
diff --git a/test/unit/actions/config_test.js b/test/unit/actions/config_test.js
index 14198fa8a..648f456fb 100644
--- a/test/unit/actions/config_test.js
+++ b/test/unit/actions/config_test.js
@@ -1,36 +1,34 @@
-var jsdom = require('mocha-jsdom')
+// var jsdom = require('mocha-jsdom')
var assert = require('assert')
var freeze = require('deep-freeze-strict')
var path = require('path')
var actions = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'actions.js'))
-var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
-
-describe ('config view actions', function() {
+var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
+describe('config view actions', function () {
var initialState = {
metamask: {
rpcTarget: 'foo',
- frequentRpcList: []
+ frequentRpcList: [],
},
appState: {
currentView: {
name: 'accounts',
- }
- }
+ },
+ },
}
freeze(initialState)
- describe('SHOW_CONFIG_PAGE', function() {
- it('should set appState.currentView.name to config', function() {
+ describe('SHOW_CONFIG_PAGE', function () {
+ it('should set appState.currentView.name to config', function () {
var result = reducers(initialState, actions.showConfigPage())
assert.equal(result.appState.currentView.name, 'config')
})
})
- describe('SET_RPC_TARGET', function() {
-
- it('sets the state.metamask.rpcTarget property of the state to the action.value', function() {
+ describe('SET_RPC_TARGET', function () {
+ it('sets the state.metamask.rpcTarget property of the state to the action.value', function () {
const action = {
type: actions.SET_RPC_TARGET,
value: 'foo',
@@ -41,5 +39,4 @@ describe ('config view actions', function() {
assert.equal(result.metamask.provider.rpcTarget, 'foo')
})
})
-
})
diff --git a/test/unit/actions/save_account_label_test.js b/test/unit/actions/save_account_label_test.js
index 1df428b1d..c5ffd6cbf 100644
--- a/test/unit/actions/save_account_label_test.js
+++ b/test/unit/actions/save_account_label_test.js
@@ -1,22 +1,21 @@
-var jsdom = require('mocha-jsdom')
+// var jsdom = require('mocha-jsdom')
var assert = require('assert')
var freeze = require('deep-freeze-strict')
var path = require('path')
var actions = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'actions.js'))
-var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
+var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
-describe('SAVE_ACCOUNT_LABEL', function() {
-
- it('updates the state.metamask.identities[:i].name property of the state to the action.value.label', function() {
+describe('SAVE_ACCOUNT_LABEL', function () {
+ it('updates the state.metamask.identities[:i].name property of the state to the action.value.label', function () {
var initialState = {
metamask: {
identities: {
foo: {
- name: 'bar'
- }
+ name: 'bar',
+ },
},
- }
+ },
}
freeze(initialState)
@@ -24,13 +23,13 @@ describe('SAVE_ACCOUNT_LABEL', function() {
type: actions.SAVE_ACCOUNT_LABEL,
value: {
account: 'foo',
- label: 'baz'
+ label: 'baz',
},
}
freeze(action)
var resultingState = reducers(initialState, action)
assert.equal(resultingState.metamask.identities.foo.name, action.value.label)
- });
-});
+ })
+})
diff --git a/test/unit/actions/set_selected_account_test.js b/test/unit/actions/set_selected_account_test.js
index 2dc42d2ec..28b47d09d 100644
--- a/test/unit/actions/set_selected_account_test.js
+++ b/test/unit/actions/set_selected_account_test.js
@@ -1,18 +1,17 @@
-var jsdom = require('mocha-jsdom')
+// var jsdom = require('mocha-jsdom')
var assert = require('assert')
var freeze = require('deep-freeze-strict')
var path = require('path')
var actions = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'actions.js'))
-var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
+var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
-describe('SET_SELECTED_ACCOUNT', function() {
-
- it('sets the state.appState.activeAddress property of the state to the action.value', function() {
+describe('SET_SELECTED_ACCOUNT', function () {
+ it('sets the state.appState.activeAddress property of the state to the action.value', function () {
var initialState = {
appState: {
activeAddress: 'foo',
- }
+ },
}
freeze(initialState)
@@ -24,15 +23,15 @@ describe('SET_SELECTED_ACCOUNT', function() {
var resultingState = reducers(initialState, action)
assert.equal(resultingState.appState.activeAddress, action.value)
- });
-});
+ })
+})
-describe('SHOW_ACCOUNT_DETAIL', function() {
- it('updates metamask state', function() {
+describe('SHOW_ACCOUNT_DETAIL', function () {
+ it('updates metamask state', function () {
var initialState = {
metamask: {
- selectedAddress: 'foo'
- }
+ selectedAddress: 'foo',
+ },
}
freeze(initialState)
diff --git a/test/unit/actions/tx_test.js b/test/unit/actions/tx_test.js
index bd72a666e..0ea1bfdc7 100644
--- a/test/unit/actions/tx_test.js
+++ b/test/unit/actions/tx_test.js
@@ -1,29 +1,27 @@
-var jsdom = require('mocha-jsdom')
+// var jsdom = require('mocha-jsdom')
var assert = require('assert')
var freeze = require('deep-freeze-strict')
var path = require('path')
var sinon = require('sinon')
var actions = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'actions.js'))
-var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
+var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
-describe('tx confirmation screen', function() {
-
- beforeEach(function() {
- this.sinon = sinon.sandbox.create();
- });
+describe('tx confirmation screen', function () {
+ beforeEach(function () {
+ this.sinon = sinon.sandbox.create()
+ })
- afterEach(function(){
- this.sinon.restore();
- });
+ afterEach(function () {
+ this.sinon.restore()
+ })
var initialState, result
- describe('when there is only one tx', function() {
+ describe('when there is only one tx', function () {
var firstTxId = 1457634084250832
- beforeEach(function() {
-
+ beforeEach(function () {
initialState = {
appState: {
currentView: {
@@ -34,70 +32,66 @@ describe('tx confirmation screen', function() {
unapprovedTxs: {
'1457634084250832': {
id: 1457634084250832,
- status: "unconfirmed",
+ status: 'unconfirmed',
time: 1457634084250,
- }
+ },
},
- }
+ },
}
freeze(initialState)
})
- describe('cancelTx', function() {
-
- before(function(done) {
+ describe('cancelTx', function () {
+ before(function (done) {
actions._setBackgroundConnection({
- approveTransaction(txId, cb) { cb('An error!') },
- cancelTransaction(txId) { /* noop */ },
- clearSeedWordCache(cb) { cb() },
+ approveTransaction (txId, cb) { cb('An error!') },
+ cancelTransaction (txId) { /* noop */ },
+ clearSeedWordCache (cb) { cb() },
})
- let action = actions.cancelTx({value: firstTxId})
+ const action = actions.cancelTx({value: firstTxId})
result = reducers(initialState, action)
done()
})
- it('should transition to the account detail view', function() {
+ it('should transition to the account detail view', function () {
assert.equal(result.appState.currentView.name, 'accountDetail')
})
- it('should have no unconfirmed txs remaining', function() {
+ it('should have no unconfirmed txs remaining', function () {
var count = getUnconfirmedTxCount(result)
assert.equal(count, 0)
})
})
- describe('sendTx', function() {
+ describe('sendTx', function () {
var result
- describe('when there is an error', function() {
-
- before(function(done) {
- alert = () => {/* noop */}
-
+ describe('when there is an error', function () {
+ before(function (done) {
actions._setBackgroundConnection({
- approveTransaction(txId, cb) { cb({message: 'An error!'}) },
+ approveTransaction (txId, cb) { cb({message: 'An error!'}) },
})
- actions.sendTx({id: firstTxId})(function(action) {
+ actions.sendTx({id: firstTxId})(function (action) {
result = reducers(initialState, action)
done()
})
})
- it('should stay on the page', function() {
+ it('should stay on the page', function () {
assert.equal(result.appState.currentView.name, 'confTx')
})
- it('should set errorMessage on the currentView', function() {
+ it('should set errorMessage on the currentView', function () {
assert(result.appState.currentView.errorMessage)
})
})
- describe('when there is success', function() {
- it('should complete tx and go home', function() {
+ describe('when there is success', function () {
+ it('should complete tx and go home', function () {
actions._setBackgroundConnection({
- approveTransaction(txId, cb) { cb() },
+ approveTransaction (txId, cb) { cb() },
})
var dispatchExpect = sinon.mock()
@@ -108,10 +102,10 @@ describe('tx confirmation screen', function() {
})
})
- describe('when there are two pending txs', function() {
+ describe('when there are two pending txs', function () {
var firstTxId = 1457634084250832
var result, initialState
- before(function(done) {
+ before(function (done) {
initialState = {
appState: {
currentView: {
@@ -122,42 +116,42 @@ describe('tx confirmation screen', function() {
unapprovedTxs: {
'1457634084250832': {
id: firstTxId,
- status: "unconfirmed",
+ status: 'unconfirmed',
time: 1457634084250,
},
'1457634084250833': {
id: 1457634084250833,
- status: "unconfirmed",
+ status: 'unconfirmed',
time: 1457634084255,
},
},
- }
+ },
}
freeze(initialState)
// Mocking a background connection:
actions._setBackgroundConnection({
- approveTransaction(firstTxId, cb) { cb() },
+ approveTransaction (firstTxId, cb) { cb() },
})
- let action = actions.sendTx({id: firstTxId})(function(action) {
+ actions.sendTx({id: firstTxId})(function (action) {
result = reducers(initialState, action)
})
done()
})
- it('should stay on the confTx view', function() {
+ it('should stay on the confTx view', function () {
assert.equal(result.appState.currentView.name, 'confTx')
})
- it('should transition to the first tx', function() {
+ it('should transition to the first tx', function () {
assert.equal(result.appState.currentView.context, 0)
})
})
})
-});
+})
-function getUnconfirmedTxCount(state) {
+function getUnconfirmedTxCount (state) {
var txs = state.metamask.unapprovedTxs
var count = Object.keys(txs).length
return count
diff --git a/test/unit/actions/view_info_test.js b/test/unit/actions/view_info_test.js
index 0558c6e42..69895d801 100644
--- a/test/unit/actions/view_info_test.js
+++ b/test/unit/actions/view_info_test.js
@@ -1,23 +1,22 @@
-var jsdom = require('mocha-jsdom')
+// var jsdom = require('mocha-jsdom')
var assert = require('assert')
var freeze = require('deep-freeze-strict')
var path = require('path')
var actions = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'actions.js'))
-var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
+var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
-describe('SHOW_INFO_PAGE', function() {
-
- it('sets the state.appState.currentView.name property to info', function() {
+describe('SHOW_INFO_PAGE', function () {
+ it('sets the state.appState.currentView.name property to info', function () {
var initialState = {
appState: {
activeAddress: 'foo',
- }
+ },
}
freeze(initialState)
const action = actions.showInfoPage()
var resultingState = reducers(initialState, action)
assert.equal(resultingState.appState.currentView.name, 'info')
- });
-});
+ })
+})
diff --git a/test/unit/actions/warning_test.js b/test/unit/actions/warning_test.js
index 37be9ee85..28b565499 100644
--- a/test/unit/actions/warning_test.js
+++ b/test/unit/actions/warning_test.js
@@ -1,14 +1,13 @@
-var jsdom = require('mocha-jsdom')
+// var jsdom = require('mocha-jsdom')
var assert = require('assert')
var freeze = require('deep-freeze-strict')
var path = require('path')
var actions = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'actions.js'))
-var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
+var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
-describe('action DISPLAY_WARNING', function() {
-
- it('sets appState.warning to provided value', function() {
+describe('action DISPLAY_WARNING', function () {
+ it('sets appState.warning to provided value', function () {
var initialState = {
appState: {},
}
@@ -20,5 +19,5 @@ describe('action DISPLAY_WARNING', function() {
const resultingState = reducers(initialState, action)
assert.equal(resultingState.appState.warning, warningText, 'warning text set')
- });
-});
+ })
+})
diff --git a/test/unit/address-book-controller.js b/test/unit/address-book-controller.js
index f345b0328..655c9022c 100644
--- a/test/unit/address-book-controller.js
+++ b/test/unit/address-book-controller.js
@@ -1,5 +1,4 @@
const assert = require('assert')
-const extend = require('xtend')
const AddressBookController = require('../../app/scripts/controllers/address-book')
const mockKeyringController = {
@@ -7,21 +6,20 @@ const mockKeyringController = {
getState: function () {
return {
identities: {
- '0x0aaa' : {
+ '0x0aaa': {
address: '0x0aaa',
name: 'owned',
- }
- }
+ },
+ },
}
- }
- }
+ },
+ },
}
-
-describe('address-book-controller', function() {
+describe('address-book-controller', function () {
var addressBookController
- beforeEach(function() {
+ beforeEach(function () {
addressBookController = new AddressBookController({}, mockKeyringController)
})
diff --git a/test/unit/components/binary-renderer-test.js b/test/unit/components/binary-renderer-test.js
index 3264faddc..ee2fa8b60 100644
--- a/test/unit/components/binary-renderer-test.js
+++ b/test/unit/components/binary-renderer-test.js
@@ -1,24 +1,22 @@
var assert = require('assert')
var BinaryRenderer = require('../../../ui/app/components/binary-renderer')
-describe('BinaryRenderer', function() {
-
+describe('BinaryRenderer', function () {
let binaryRenderer
const message = 'Hello, world!'
const buffer = new Buffer(message, 'utf8')
const hex = buffer.toString('hex')
- beforeEach(function() {
+ beforeEach(function () {
binaryRenderer = new BinaryRenderer()
})
- it('recovers message', function() {
+ it('recovers message', function () {
const result = binaryRenderer.hexToText(hex)
assert.equal(result, message)
})
-
- it('recovers message with hex prefix', function() {
+ it('recovers message with hex prefix', function () {
const result = binaryRenderer.hexToText('0x' + hex)
assert.equal(result, message)
})
diff --git a/test/unit/components/bn-as-decimal-input-test.js b/test/unit/components/bn-as-decimal-input-test.js
new file mode 100644
index 000000000..106b3a871
--- /dev/null
+++ b/test/unit/components/bn-as-decimal-input-test.js
@@ -0,0 +1,51 @@
+var assert = require('assert')
+
+const additions = require('react-testutils-additions')
+const h = require('react-hyperscript')
+const ReactTestUtils = require('react-addons-test-utils')
+const ethUtil = require('ethereumjs-util')
+const BN = ethUtil.BN
+
+var BnInput = require('../../../ui/app/components/bn-as-decimal-input')
+
+describe('BnInput', function () {
+ it('can tolerate a gas decimal number at a high precision', function (done) {
+ const renderer = ReactTestUtils.createRenderer()
+
+ let valueStr = '20'
+ while (valueStr.length < 20) {
+ valueStr += '0'
+ }
+ const value = new BN(valueStr, 10)
+
+ const inputStr = '2.3'
+
+ let targetStr = '23'
+ while (targetStr.length < 19) {
+ targetStr += '0'
+ }
+ const target = new BN(targetStr, 10)
+
+ const precision = 18 // ether precision
+ const scale = 18
+
+ const props = {
+ value,
+ scale,
+ precision,
+ onChange: (newBn) => {
+ assert.equal(newBn.toString(), target.toString(), 'should tolerate increase')
+ done()
+ },
+ }
+
+ const inputComponent = h(BnInput, props)
+ const component = additions.renderIntoDocument(inputComponent)
+ renderer.render(inputComponent)
+ const input = additions.find(component, 'input.hex-input')[0]
+ ReactTestUtils.Simulate.change(input, { preventDefault () {}, target: {
+ value: inputStr,
+ checkValidity () { return true } },
+ })
+ })
+})
diff --git a/test/unit/components/pending-tx-test.js b/test/unit/components/pending-tx-test.js
new file mode 100644
index 000000000..22a98bc93
--- /dev/null
+++ b/test/unit/components/pending-tx-test.js
@@ -0,0 +1,77 @@
+const assert = require('assert')
+const additions = require('react-testutils-additions')
+const h = require('react-hyperscript')
+const PendingTx = require('../../../ui/app/components/pending-tx')
+const ReactTestUtils = require('react-addons-test-utils')
+const ethUtil = require('ethereumjs-util')
+
+describe('PendingTx', function () {
+ const identities = {
+ '0xfdea65c8e26263f6d9a1b5de9555d2931a33b826': {
+ name: 'Main Account 1',
+ balance: '0x00000000000000056bc75e2d63100000',
+ },
+ }
+
+ const gasPrice = '0x4A817C800' // 20 Gwei
+ const txData = {
+ 'id': 5021615666270214,
+ 'time': 1494458763011,
+ 'status': 'unapproved',
+ 'metamaskNetworkId': '1494442339676',
+ 'txParams': {
+ 'from': '0xfdea65c8e26263f6d9a1b5de9555d2931a33b826',
+ 'to': '0xc5b8dbac4c1d3f152cdeb400e2313f309c410acb',
+ 'value': '0xde0b6b3a7640000',
+ gasPrice,
+ 'gas': '0x7b0c'},
+ 'gasLimitSpecified': false,
+ 'estimatedGas': '0x5208',
+ }
+
+
+ it('should use updated values when edited.', function (done) {
+ const renderer = ReactTestUtils.createRenderer()
+ const newGasPrice = '0x77359400'
+
+ const props = {
+ identities,
+ accounts: identities,
+ txData,
+ sendTransaction: (txMeta, event) => {
+ // Assert changes:
+ const result = ethUtil.addHexPrefix(txMeta.txParams.gasPrice)
+ assert.notEqual(result, gasPrice, 'gas price should change')
+ assert.equal(result, newGasPrice, 'gas price assigned.')
+ done()
+ },
+ }
+
+ const pendingTxComponent = h(PendingTx, props)
+ const component = additions.renderIntoDocument(pendingTxComponent)
+ renderer.render(pendingTxComponent)
+ const result = renderer.getRenderOutput()
+ assert.equal(result.type, 'div', 'should create a div')
+
+ try {
+ const input = additions.find(component, '.cell.row input[type="number"]')[1]
+ ReactTestUtils.Simulate.change(input, {
+ target: {
+ value: 2,
+ checkValidity () { return true },
+ },
+ })
+
+ const form = additions.find(component, 'form')[0]
+ form.checkValidity = () => true
+ form.getFormEl = () => { return { checkValidity () { return true } } }
+ ReactTestUtils.Simulate.submit(form, { preventDefault () {}, target: { checkValidity () {
+ return true
+ } } })
+ } catch (e) {
+ console.log('WHAAAA')
+ console.error(e)
+ }
+ })
+})
+
diff --git a/test/unit/config-manager-test.js b/test/unit/config-manager-test.js
index 05324e741..b710e2dfb 100644
--- a/test/unit/config-manager-test.js
+++ b/test/unit/config-manager-test.js
@@ -2,26 +2,22 @@
global.fetch = global.fetch || require('isomorphic-fetch')
const assert = require('assert')
-const extend = require('xtend')
-const rp = require('request-promise')
-const nock = require('nock')
const configManagerGen = require('../lib/mock-config-manager')
-describe('config-manager', function() {
+describe('config-manager', function () {
var configManager
- beforeEach(function() {
+ beforeEach(function () {
configManager = configManagerGen()
})
- describe('#setConfig', function() {
-
+ describe('#setConfig', function () {
it('should set the config key', function () {
var testConfig = {
provider: {
type: 'rpc',
- rpcTarget: 'foobar'
- }
+ rpcTarget: 'foobar',
+ },
}
configManager.setConfig(testConfig)
var result = configManager.getData()
@@ -30,17 +26,17 @@ describe('config-manager', function() {
assert.equal(result.config.provider.rpcTarget, testConfig.provider.rpcTarget)
})
- it('setting wallet should not overwrite config', function() {
+ it('setting wallet should not overwrite config', function () {
var testConfig = {
provider: {
type: 'rpc',
- rpcTarget: 'foobar'
+ rpcTarget: 'foobar',
},
}
configManager.setConfig(testConfig)
var testWallet = {
- name: 'this is my fake wallet'
+ name: 'this is my fake wallet',
}
configManager.setWallet(testWallet)
@@ -58,13 +54,13 @@ describe('config-manager', function() {
})
})
- describe('wallet nicknames', function() {
- it('should return null when no nicknames are saved', function() {
+ describe('wallet nicknames', function () {
+ it('should return null when no nicknames are saved', function () {
var nick = configManager.nicknameForWallet('0x0')
assert.equal(nick, null, 'no nickname returned')
})
- it('should persist nicknames', function() {
+ it('should persist nicknames', function () {
var account = '0x0'
var nick1 = 'foo'
var nick2 = 'bar'
@@ -79,8 +75,8 @@ describe('config-manager', function() {
})
})
- describe('rpc manipulations', function() {
- it('changing rpc should return a different rpc', function() {
+ describe('rpc manipulations', function () {
+ it('changing rpc should return a different rpc', function () {
var firstRpc = 'first'
var secondRpc = 'second'
@@ -94,21 +90,21 @@ describe('config-manager', function() {
})
})
- describe('transactions', function() {
- beforeEach(function() {
+ describe('transactions', function () {
+ beforeEach(function () {
configManager.setTxList([])
})
- describe('#getTxList', function() {
- it('when new should return empty array', function() {
+ describe('#getTxList', function () {
+ it('when new should return empty array', function () {
var result = configManager.getTxList()
assert.ok(Array.isArray(result))
assert.equal(result.length, 0)
})
})
- describe('#setTxList', function() {
- it('saves the submitted data to the tx list', function() {
+ describe('#setTxList', function () {
+ it('saves the submitted data to the tx list', function () {
var target = [{ foo: 'bar' }]
configManager.setTxList(target)
var result = configManager.getTxList()
diff --git a/test/unit/currency-controller-test.js b/test/unit/currency-controller-test.js
index 079f8b488..5eeaf9bcc 100644
--- a/test/unit/currency-controller-test.js
+++ b/test/unit/currency-controller-test.js
@@ -2,26 +2,23 @@
global.fetch = global.fetch || require('isomorphic-fetch')
const assert = require('assert')
-const extend = require('xtend')
-const rp = require('request-promise')
const nock = require('nock')
const CurrencyController = require('../../app/scripts/controllers/currency')
-describe('currency-controller', function() {
+describe('currency-controller', function () {
var currencyController
- beforeEach(function() {
+ beforeEach(function () {
currencyController = new CurrencyController()
})
- describe('currency conversions', function() {
-
- describe('#setCurrentCurrency', function() {
- it('should return USD as default', function() {
+ describe('currency conversions', function () {
+ describe('#setCurrentCurrency', function () {
+ it('should return USD as default', function () {
assert.equal(currencyController.getCurrentCurrency(), 'USD')
})
- it('should be able to set to other currency', function() {
+ it('should be able to set to other currency', function () {
assert.equal(currencyController.getCurrentCurrency(), 'USD')
currencyController.setCurrentCurrency('JPY')
var result = currencyController.getCurrentCurrency()
@@ -29,39 +26,38 @@ describe('currency-controller', function() {
})
})
- describe('#getConversionRate', function() {
- it('should return undefined if non-existent', function() {
+ describe('#getConversionRate', function () {
+ it('should return undefined if non-existent', function () {
var result = currencyController.getConversionRate()
assert.ok(!result)
})
})
- describe('#updateConversionRate', function() {
- it('should retrieve an update for ETH to USD and set it in memory', function(done) {
+ describe('#updateConversionRate', function () {
+ it('should retrieve an update for ETH to USD and set it in memory', function (done) {
this.timeout(15000)
- var usdMock = nock('https://www.cryptonator.com')
+ nock('https://api.cryptonator.com')
.get('/api/ticker/eth-USD')
.reply(200, '{"ticker":{"base":"ETH","target":"USD","price":"11.02456145","volume":"44948.91745289","change":"-0.01472534"},"timestamp":1472072136,"success":true,"error":""}')
assert.equal(currencyController.getConversionRate(), 0)
currencyController.setCurrentCurrency('USD')
currencyController.updateConversionRate()
- .then(function() {
+ .then(function () {
var result = currencyController.getConversionRate()
console.log('currencyController.getConversionRate:', result)
assert.equal(typeof result, 'number')
done()
- }).catch(function(err) {
+ }).catch(function (err) {
done(err)
})
-
})
- it('should work for JPY as well.', function() {
+ it('should work for JPY as well.', function () {
this.timeout(15000)
assert.equal(currencyController.getConversionRate(), 0)
- var jpyMock = nock('https://www.cryptonator.com')
+ nock('https://api.cryptonator.com')
.get('/api/ticker/eth-JPY')
.reply(200, '{"ticker":{"base":"ETH","target":"JPY","price":"11.02456145","volume":"44948.91745289","change":"-0.01472534"},"timestamp":1472072136,"success":true,"error":""}')
@@ -69,19 +65,18 @@ describe('currency-controller', function() {
var promise = new Promise(
function (resolve, reject) {
currencyController.setCurrentCurrency('JPY')
- currencyController.updateConversionRate().then(function() {
+ currencyController.updateConversionRate().then(function () {
resolve()
})
- })
+ })
- promise.then(function() {
+ promise.then(function () {
var result = currencyController.getConversionRate()
assert.equal(typeof result, 'number')
- }).catch(function(err) {
+ }).catch(function (done, err) {
done(err)
})
})
})
})
-
})
diff --git a/test/unit/explorer-link-test.js b/test/unit/explorer-link-test.js
index 4f0230c2c..a02564509 100644
--- a/test/unit/explorer-link-test.js
+++ b/test/unit/explorer-link-test.js
@@ -1,16 +1,14 @@
var assert = require('assert')
var linkGen = require('../../ui/lib/explorer-link')
-describe('explorer-link', function() {
-
- it('adds ropsten prefix to ropsten test network', function() {
+describe('explorer-link', function () {
+ it('adds ropsten prefix to ropsten test network', function () {
var result = linkGen('hash', '3')
assert.notEqual(result.indexOf('ropsten'), -1, 'ropsten injected')
})
- it('adds kovan prefix to kovan test network', function() {
+ it('adds kovan prefix to kovan test network', function () {
var result = linkGen('hash', '42')
assert.notEqual(result.indexOf('kovan'), -1, 'kovan injected')
})
-
})
diff --git a/test/unit/keyring-controller-test.js b/test/unit/keyring-controller-test.js
index efd0a3546..2d9a53723 100644
--- a/test/unit/keyring-controller-test.js
+++ b/test/unit/keyring-controller-test.js
@@ -3,21 +3,18 @@ const KeyringController = require('../../app/scripts/keyring-controller')
const configManagerGen = require('../lib/mock-config-manager')
const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN
-const async = require('async')
const mockEncryptor = require('../lib/mock-encryptor')
-const MockSimpleKeychain = require('../lib/mock-simple-keychain')
const sinon = require('sinon')
-describe('KeyringController', function() {
+describe('KeyringController', function () {
+ let keyringController
+ const password = 'password123'
+ const seedWords = 'puzzle seed penalty soldier say clay field arctic metal hen cage runway'
+ const addresses = ['eF35cA8EbB9669A35c31b5F6f249A9941a812AC1'.toLowerCase()]
+ const accounts = []
+ // let originalKeystore
- let keyringController, state
- let password = 'password123'
- let seedWords = 'puzzle seed penalty soldier say clay field arctic metal hen cage runway'
- let addresses = ['eF35cA8EbB9669A35c31b5F6f249A9941a812AC1'.toLowerCase()]
- let accounts = []
- let originalKeystore
-
- beforeEach(function(done) {
+ beforeEach(function (done) {
this.sinon = sinon.sandbox.create()
window.localStorage = {} // Hacking localStorage support into JSDom
@@ -25,10 +22,10 @@ describe('KeyringController', function() {
configManager: configManagerGen(),
txManager: {
getTxList: () => [],
- getUnapprovedTxList: () => []
+ getUnapprovedTxList: () => [],
},
ethStore: {
- addAccount(acct) { accounts.push(ethUtil.addHexPrefix(acct)) },
+ addAccount (acct) { accounts.push(ethUtil.addHexPrefix(acct)) },
},
})
@@ -38,7 +35,7 @@ describe('KeyringController', function() {
keyringController.createNewVaultAndKeychain(password)
.then(function (newState) {
- state = newState
+ newState
done()
})
.catch((err) => {
@@ -46,7 +43,7 @@ describe('KeyringController', function() {
})
})
- afterEach(function() {
+ afterEach(function () {
// Cleanup mocks
this.sinon.restore()
})
@@ -54,7 +51,7 @@ describe('KeyringController', function() {
describe('#createNewVaultAndKeychain', function () {
this.timeout(10000)
- it('should set a vault on the configManager', function(done) {
+ it('should set a vault on the configManager', function (done) {
keyringController.store.updateState({ vault: null })
assert(!keyringController.store.getState().vault, 'no previous vault')
keyringController.createNewVaultAndKeychain(password)
@@ -69,15 +66,14 @@ describe('KeyringController', function() {
})
})
- describe('#restoreKeyring', function() {
-
- it(`should pass a keyring's serialized data back to the correct type.`, function(done) {
+ describe('#restoreKeyring', function () {
+ it(`should pass a keyring's serialized data back to the correct type.`, function (done) {
const mockSerialized = {
type: 'HD Key Tree',
data: {
mnemonic: seedWords,
numberOfAccounts: 1,
- }
+ },
}
const mock = this.sinon.mock(keyringController)
@@ -100,8 +96,8 @@ describe('KeyringController', function() {
})
})
- describe('#createNickname', function() {
- it('should add the address to the identities hash', function() {
+ describe('#createNickname', function () {
+ it('should add the address to the identities hash', function () {
const fakeAddress = '0x12345678'
keyringController.createNickname(fakeAddress)
const identities = keyringController.memStore.getState().identities
@@ -110,8 +106,8 @@ describe('KeyringController', function() {
})
})
- describe('#saveAccountLabel', function() {
- it ('sets the nickname', function(done) {
+ describe('#saveAccountLabel', function () {
+ it('sets the nickname', function (done) {
const account = addresses[0]
var nick = 'Test nickname'
const identities = keyringController.memStore.getState().identities
@@ -134,31 +130,30 @@ describe('KeyringController', function() {
})
})
- describe('#getAccounts', function() {
- it('returns the result of getAccounts for each keyring', function(done) {
+ describe('#getAccounts', function () {
+ it('returns the result of getAccounts for each keyring', function (done) {
keyringController.keyrings = [
- { getAccounts() { return Promise.resolve([1,2,3]) } },
- { getAccounts() { return Promise.resolve([4,5,6]) } },
+ { getAccounts () { return Promise.resolve([1, 2, 3]) } },
+ { getAccounts () { return Promise.resolve([4, 5, 6]) } },
]
keyringController.getAccounts()
.then((result) => {
- assert.deepEqual(result, [1,2,3,4,5,6])
+ assert.deepEqual(result, [1, 2, 3, 4, 5, 6])
done()
})
})
})
- describe('#addGasBuffer', function() {
- it('adds 100k gas buffer to estimates', function() {
-
+ describe('#addGasBuffer', function () {
+ it('adds 100k gas buffer to estimates', function () {
const gas = '0x04ee59' // Actual estimated gas example
const tooBigOutput = '0x80674f9' // Actual bad output
const bnGas = new BN(ethUtil.stripHexPrefix(gas), 16)
const correctBuffer = new BN('100000', 10)
const correct = bnGas.add(correctBuffer)
- const tooBig = new BN(tooBigOutput, 16)
+ // const tooBig = new BN(tooBigOutput, 16)
const result = keyringController.addGasBuffer(gas)
const bnResult = new BN(ethUtil.stripHexPrefix(result), 16)
diff --git a/test/unit/linting_test.js b/test/unit/linting_test.js
index 75d90652d..45578fc36 100644
--- a/test/unit/linting_test.js
+++ b/test/unit/linting_test.js
@@ -1,9 +1,9 @@
// LINTING:
-const lint = require('mocha-eslint');
-const lintPaths = ['app/**/*.js', 'ui/**/*.js', '!node_modules/**', '!dist/**', '!docs/**', '!app/scripts/chromereload.js']
+const lint = require('mocha-eslint')
+const lintPaths = ['app/**/*.js', 'ui/**/*.js', 'test/**/*.js', '!node_modules/**', '!dist/**', '!docs/**', '!app/scripts/chromereload.js']
const lintOptions = {
strict: false,
}
-lint(lintPaths, lintOptions) \ No newline at end of file
+lint(lintPaths, lintOptions)
diff --git a/test/unit/message-manager-test.js b/test/unit/message-manager-test.js
index faf7429d4..30cb4f067 100644
--- a/test/unit/message-manager-test.js
+++ b/test/unit/message-manager-test.js
@@ -1,29 +1,26 @@
const assert = require('assert')
-const extend = require('xtend')
-const EventEmitter = require('events')
-
const MessageManger = require('../../app/scripts/lib/message-manager')
-describe('Transaction Manager', function() {
+describe('Transaction Manager', function () {
let messageManager
- beforeEach(function() {
- messageManager = new MessageManger ()
+ beforeEach(function () {
+ messageManager = new MessageManger()
})
- describe('#getMsgList', function() {
- it('when new should return empty array', function() {
+ describe('#getMsgList', function () {
+ it('when new should return empty array', function () {
var result = messageManager.messages
assert.ok(Array.isArray(result))
assert.equal(result.length, 0)
})
- it('should also return transactions from local storage if any', function() {
+ it('should also return transactions from local storage if any', function () {
})
})
- describe('#addMsg', function() {
- it('adds a Msg returned in getMsgList', function() {
+ describe('#addMsg', function () {
+ it('adds a Msg returned in getMsgList', function () {
var Msg = { id: 1, status: 'approved', metamaskNetworkId: 'unit test' }
messageManager.addMsg(Msg)
var result = messageManager.messages
@@ -33,8 +30,8 @@ describe('Transaction Manager', function() {
})
})
- describe('#setMsgStatusApproved', function() {
- it('sets the Msg status to approved', function() {
+ describe('#setMsgStatusApproved', function () {
+ it('sets the Msg status to approved', function () {
var Msg = { id: 1, status: 'unapproved', metamaskNetworkId: 'unit test' }
messageManager.addMsg(Msg)
messageManager.setMsgStatusApproved(1)
@@ -45,8 +42,8 @@ describe('Transaction Manager', function() {
})
})
- describe('#rejectMsg', function() {
- it('sets the Msg status to rejected', function() {
+ describe('#rejectMsg', function () {
+ it('sets the Msg status to rejected', function () {
var Msg = { id: 1, status: 'unapproved', metamaskNetworkId: 'unit test' }
messageManager.addMsg(Msg)
messageManager.rejectMsg(1)
@@ -57,8 +54,8 @@ describe('Transaction Manager', function() {
})
})
- describe('#_updateMsg', function() {
- it('replaces the Msg with the same id', function() {
+ describe('#_updateMsg', function () {
+ it('replaces the Msg with the same id', function () {
messageManager.addMsg({ id: '1', status: 'unapproved', metamaskNetworkId: 'unit test' })
messageManager.addMsg({ id: '2', status: 'approved', metamaskNetworkId: 'unit test' })
messageManager._updateMsg({ id: '1', status: 'blah', hash: 'foo', metamaskNetworkId: 'unit test' })
@@ -67,19 +64,19 @@ describe('Transaction Manager', function() {
})
})
- describe('#getUnapprovedMsgs', function() {
- it('returns unapproved Msgs in a hash', function() {
+ describe('#getUnapprovedMsgs', function () {
+ it('returns unapproved Msgs in a hash', function () {
messageManager.addMsg({ id: '1', status: 'unapproved', metamaskNetworkId: 'unit test' })
messageManager.addMsg({ id: '2', status: 'approved', metamaskNetworkId: 'unit test' })
- let result = messageManager.getUnapprovedMsgs()
+ const result = messageManager.getUnapprovedMsgs()
assert.equal(typeof result, 'object')
assert.equal(result['1'].status, 'unapproved')
assert.equal(result['2'], undefined)
})
})
- describe('#getMsg', function() {
- it('returns a Msg with the requested id', function() {
+ describe('#getMsg', function () {
+ it('returns a Msg with the requested id', function () {
messageManager.addMsg({ id: '1', status: 'unapproved', metamaskNetworkId: 'unit test' })
messageManager.addMsg({ id: '2', status: 'approved', metamaskNetworkId: 'unit test' })
assert.equal(messageManager.getMsg('1').status, 'unapproved')
diff --git a/test/unit/metamask-controller-test.js b/test/unit/metamask-controller-test.js
index 78b9e9df7..5ee0a6c84 100644
--- a/test/unit/metamask-controller-test.js
+++ b/test/unit/metamask-controller-test.js
@@ -4,11 +4,9 @@ const clone = require('clone')
const MetaMaskController = require('../../app/scripts/metamask-controller')
const firstTimeState = require('../../app/scripts/first-time-state')
-const STORAGE_KEY = 'metamask-config'
-
-describe('MetaMaskController', function() {
+describe('MetaMaskController', function () {
const noop = () => {}
- let controller = new MetaMaskController({
+ const metamaskController = new MetaMaskController({
showUnconfirmedMessage: noop,
unlockAccountMessage: noop,
showUnapprovedTx: noop,
@@ -16,14 +14,18 @@ describe('MetaMaskController', function() {
initState: clone(firstTimeState),
})
- beforeEach(function() {
+ beforeEach(function () {
// sinon allows stubbing methods that are easily verified
this.sinon = sinon.sandbox.create()
})
- afterEach(function() {
+ afterEach(function () {
// sinon requires cleanup otherwise it will overwrite context
this.sinon.restore()
})
-}) \ No newline at end of file
+ describe('Metamask Controller', function () {
+ assert(metamaskController)
+ })
+})
+
diff --git a/test/unit/migrations-test.js b/test/unit/migrations-test.js
index ccd1477b0..5bad25a45 100644
--- a/test/unit/migrations-test.js
+++ b/test/unit/migrations-test.js
@@ -3,7 +3,7 @@ const path = require('path')
const wallet1 = require(path.join('..', 'lib', 'migrations', '001.json'))
const vault4 = require(path.join('..', 'lib', 'migrations', '004.json'))
-let vault5, vault6, vault7, vault8, vault9, vault10, vault11
+let vault5, vault6, vault7, vault8, vault9 // vault10, vault11
const migration2 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '002'))
const migration3 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '003'))
@@ -16,6 +16,7 @@ const migration9 = require(path.join('..', '..', 'app', 'scripts', 'migrations',
const migration10 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '010'))
const migration11 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '011'))
const migration12 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '012'))
+const migration13 = require(path.join('..', '..', 'app', 'scripts', 'migrations', '013'))
const oldTestRpc = 'https://rawtestrpc.metamask.io/'
@@ -23,7 +24,6 @@ const newTestRpc = 'https://testrpc.metamask.io/'
describe('wallet1 is migrated successfully', () => {
it('should convert providers', () => {
-
wallet1.data.config.provider = { type: 'etherscan', rpcTarget: null }
return migration2.migrate(wallet1)
@@ -98,7 +98,11 @@ describe('wallet1 is migrated successfully', () => {
}).then((twelfthResult) => {
assert.equal(twelfthResult.data.NoticeController.noticesList[0].body, '', 'notices that have been read should have an empty body.')
assert.equal(twelfthResult.data.NoticeController.noticesList[1].body, 'nonempty', 'notices that have not been read should not have an empty body.')
- })
+ assert.equal(twelfthResult.data.config.provider.type, 'testnet', 'network is originally testnet.')
+ return migration13.migrate(twelfthResult)
+ }).then((thirteenthResult) => {
+ assert.equal(thirteenthResult.data.config.provider.type, 'ropsten', 'network has been changed to ropsten.')
+ })
})
})
diff --git a/test/unit/migrator-test.js b/test/unit/migrator-test.js
new file mode 100644
index 000000000..16066fefe
--- /dev/null
+++ b/test/unit/migrator-test.js
@@ -0,0 +1,41 @@
+const assert = require('assert')
+const clone = require('clone')
+const Migrator = require('../../app/scripts/lib/migrator/')
+const migrations = [
+ {
+ version: 1,
+ migrate: (data) => {
+ // clone the data just like we do in migrations
+ const clonedData = clone(data)
+ clonedData.meta.version = 1
+ return Promise.resolve(clonedData)
+ },
+ },
+ {
+ version: 2,
+ migrate: (data) => {
+ const clonedData = clone(data)
+ clonedData.meta.version = 2
+ return Promise.resolve(clonedData)
+ },
+ },
+ {
+ version: 3,
+ migrate: (data) => {
+ const clonedData = clone(data)
+ clonedData.meta.version = 3
+ return Promise.resolve(clonedData)
+ },
+ },
+]
+const versionedData = {meta: {version: 0}, data: {hello: 'world'}}
+describe('Migrator', () => {
+ const migrator = new Migrator({ migrations })
+ it('migratedData version should be version 3', (done) => {
+ migrator.migrateData(versionedData)
+ .then((migratedData) => {
+ assert.equal(migratedData.meta.version, migrations[2].version)
+ done()
+ }).catch(done)
+ })
+})
diff --git a/test/unit/nameForAccount_test.js b/test/unit/nameForAccount_test.js
index 6839d40f8..e7c0b18b4 100644
--- a/test/unit/nameForAccount_test.js
+++ b/test/unit/nameForAccount_test.js
@@ -4,25 +4,23 @@ var sinon = require('sinon')
var path = require('path')
var contractNamer = require(path.join(__dirname, '..', '..', 'ui', 'lib', 'contract-namer.js'))
-describe('contractNamer', function() {
-
- beforeEach(function() {
+describe('contractNamer', function () {
+ beforeEach(function () {
this.sinon = sinon.sandbox.create()
})
- afterEach(function() {
+ afterEach(function () {
this.sinon.restore()
})
- describe('naming a contract', function() {
-
- it('should return nothing for an unknown random account', function() {
+ describe('naming a contract', function () {
+ it('should return nothing for an unknown random account', function () {
const input = '0x2386F26FC10000'
const output = contractNamer(input)
assert.deepEqual(output, null)
})
- it('should accept identities as an optional second parameter', function() {
+ it('should accept identities as an optional second parameter', function () {
const input = '0x2386F26FC10000'.toLowerCase()
const expected = 'bar'
const identities = {}
@@ -31,7 +29,7 @@ describe('contractNamer', function() {
assert.deepEqual(output, expected)
})
- it('should check for identities case insensitively', function() {
+ it('should check for identities case insensitively', function () {
const input = '0x2386F26FC10000'.toLowerCase()
const expected = 'bar'
const identities = {}
@@ -39,6 +37,5 @@ describe('contractNamer', function() {
const output = contractNamer(input.toUpperCase(), identities)
assert.deepEqual(output, expected)
})
-
})
})
diff --git a/test/unit/network-contoller-test.js b/test/unit/network-contoller-test.js
new file mode 100644
index 000000000..0c7ee9d70
--- /dev/null
+++ b/test/unit/network-contoller-test.js
@@ -0,0 +1,77 @@
+const assert = require('assert')
+const NetworkController = require('../../app/scripts/controllers/network')
+
+describe('# Network Controller', function () {
+ let networkController
+
+ beforeEach(function () {
+ networkController = new NetworkController({
+ provider: {
+ type: 'rinkeby',
+ },
+ })
+ // stub out provider
+ networkController._provider = new Proxy({}, {
+ get: (obj, name) => {
+ return () => {}
+ },
+ })
+ networkController.providerInit = {
+ getAccounts: () => {},
+ }
+
+ networkController.ethQuery = new Proxy({}, {
+ get: (obj, name) => {
+ return () => {}
+ },
+ })
+ })
+ describe('network', function () {
+ describe('#provider', function () {
+ it('provider should be updatable without reassignment', function () {
+ networkController.initializeProvider(networkController.providerInit)
+ const provider = networkController.provider
+ networkController._provider = {test: true}
+ assert.ok(provider.test)
+ })
+ })
+ describe('#getNetworkState', function () {
+ it('should return loading when new', function () {
+ const networkState = networkController.getNetworkState()
+ assert.equal(networkState, 'loading', 'network is loading')
+ })
+ })
+
+ describe('#setNetworkState', function () {
+ it('should update the network', function () {
+ networkController.setNetworkState(1)
+ const networkState = networkController.getNetworkState()
+ assert.equal(networkState, 1, 'network is 1')
+ })
+ })
+
+ describe('#getRpcAddressForType', function () {
+ it('should return the right rpc address', function () {
+ const rpcTarget = networkController.getRpcAddressForType('mainnet')
+ assert.equal(rpcTarget, 'https://mainnet.infura.io/metamask', 'returns the right rpcAddress')
+ })
+ })
+ describe('#setProviderType', function () {
+ it('should update provider.type', function () {
+ networkController.setProviderType('mainnet')
+ const type = networkController.getProviderConfig().type
+ assert.equal(type, 'mainnet', 'provider type is updated')
+ })
+ it('should set the network to loading', function () {
+ networkController.setProviderType('mainnet')
+ const loading = networkController.isNetworkLoading()
+ assert.ok(loading, 'network is loading')
+ })
+ it('should set the right rpcTarget', function () {
+ networkController.setProviderType('mainnet')
+ const rpcTarget = networkController.getProviderConfig().rpcTarget
+ assert.equal(rpcTarget, 'https://mainnet.infura.io/metamask', 'returns the right rpcAddress')
+ })
+ })
+ })
+})
diff --git a/test/unit/nodeify-test.js b/test/unit/nodeify-test.js
index a14d34338..5aed758fa 100644
--- a/test/unit/nodeify-test.js
+++ b/test/unit/nodeify-test.js
@@ -1,22 +1,20 @@
const assert = require('assert')
const nodeify = require('../../app/scripts/lib/nodeify')
-describe('nodeify', function() {
-
+describe('nodeify', function () {
var obj = {
foo: 'bar',
promiseFunc: function (a) {
var solution = this.foo + a
return Promise.resolve(solution)
- }
+ },
}
- it('should retain original context', function(done) {
+ it('should retain original context', function (done) {
var nodified = nodeify(obj.promiseFunc).bind(obj)
nodified('baz', function (err, res) {
assert.equal(res, 'barbaz')
done()
})
})
-
})
diff --git a/test/unit/notice-controller-test.js b/test/unit/notice-controller-test.js
index ea37108bb..09eeda15c 100644
--- a/test/unit/notice-controller-test.js
+++ b/test/unit/notice-controller-test.js
@@ -1,42 +1,38 @@
const assert = require('assert')
-const extend = require('xtend')
-const rp = require('request-promise')
-const nock = require('nock')
const configManagerGen = require('../lib/mock-config-manager')
const NoticeController = require('../../app/scripts/notice-controller')
-const STORAGE_KEY = 'metamask-persistence-key'
-describe('notice-controller', function() {
+describe('notice-controller', function () {
var noticeController
- beforeEach(function() {
+ beforeEach(function () {
// simple localStorage polyfill
- let configManager = configManagerGen()
+ const configManager = configManagerGen()
noticeController = new NoticeController({
configManager: configManager,
})
})
- describe('notices', function() {
- describe('#getNoticesList', function() {
- it('should return an empty array when new', function(done) {
- var testList = [{
- id:0,
- read:false,
- title:"Futuristic Notice"
- }]
+ describe('notices', function () {
+ describe('#getNoticesList', function () {
+ it('should return an empty array when new', function (done) {
+ // const testList = [{
+ // id: 0,
+ // read: false,
+ // title: 'Futuristic Notice',
+ // }]
var result = noticeController.getNoticesList()
assert.equal(result.length, 0)
done()
})
})
- describe('#setNoticesList', function() {
+ describe('#setNoticesList', function () {
it('should set data appropriately', function (done) {
var testList = [{
- id:0,
- read:false,
- title:"Futuristic Notice"
+ id: 0,
+ read: false,
+ title: 'Futuristic Notice',
}]
noticeController.setNoticesList(testList)
var testListId = noticeController.getNoticesList()[0].id
@@ -45,12 +41,12 @@ describe('notice-controller', function() {
})
})
- describe('#updateNoticeslist', function() {
- it('should integrate the latest changes from the source', function(done) {
+ describe('#updateNoticeslist', function () {
+ it('should integrate the latest changes from the source', function (done) {
var testList = [{
- id:55,
- read:false,
- title:"Futuristic Notice"
+ id: 55,
+ read: false,
+ title: 'Futuristic Notice',
}]
noticeController.setNoticesList(testList)
noticeController.updateNoticesList().then(() => {
@@ -62,14 +58,14 @@ describe('notice-controller', function() {
})
it('should not overwrite any existing fields', function (done) {
var testList = [{
- id:0,
- read:false,
- title:"Futuristic Notice"
+ id: 0,
+ read: false,
+ title: 'Futuristic Notice',
}]
noticeController.setNoticesList(testList)
var newList = noticeController.getNoticesList()
assert.equal(newList[0].id, 0)
- assert.equal(newList[0].title, "Futuristic Notice")
+ assert.equal(newList[0].title, 'Futuristic Notice')
assert.equal(newList.length, 1)
done()
})
@@ -78,9 +74,9 @@ describe('notice-controller', function() {
describe('#markNoticeRead', function () {
it('should mark a notice as read', function (done) {
var testList = [{
- id:0,
- read:false,
- title:"Futuristic Notice"
+ id: 0,
+ read: false,
+ title: 'Futuristic Notice',
}]
noticeController.setNoticesList(testList)
noticeController.markNoticeRead(testList[0])
@@ -93,9 +89,9 @@ describe('notice-controller', function() {
describe('#getLatestUnreadNotice', function () {
it('should retrieve the latest unread notice', function (done) {
var testList = [
- {id:0,read:true,title:"Past Notice"},
- {id:1,read:false,title:"Current Notice"},
- {id:2,read:false,title:"Future Notice"},
+ {id: 0, read: true, title: 'Past Notice'},
+ {id: 1, read: false, title: 'Current Notice'},
+ {id: 2, read: false, title: 'Future Notice'},
]
noticeController.setNoticesList(testList)
var latestUnread = noticeController.getLatestUnreadNotice()
@@ -104,9 +100,9 @@ describe('notice-controller', function() {
})
it('should return undefined if no unread notices exist.', function (done) {
var testList = [
- {id:0,read:true,title:"Past Notice"},
- {id:1,read:true,title:"Current Notice"},
- {id:2,read:true,title:"Future Notice"},
+ {id: 0, read: true, title: 'Past Notice'},
+ {id: 1, read: true, title: 'Current Notice'},
+ {id: 2, read: true, title: 'Future Notice'},
]
noticeController.setNoticesList(testList)
var latestUnread = noticeController.getLatestUnreadNotice()
@@ -115,5 +111,4 @@ describe('notice-controller', function() {
})
})
})
-
})
diff --git a/test/unit/personal-message-manager-test.js b/test/unit/personal-message-manager-test.js
index f2c01392c..ec2f9a4d1 100644
--- a/test/unit/personal-message-manager-test.js
+++ b/test/unit/personal-message-manager-test.js
@@ -1,29 +1,27 @@
const assert = require('assert')
-const extend = require('xtend')
-const EventEmitter = require('events')
const PersonalMessageManager = require('../../app/scripts/lib/personal-message-manager')
-describe('Personal Message Manager', function() {
+describe('Personal Message Manager', function () {
let messageManager
- beforeEach(function() {
+ beforeEach(function () {
messageManager = new PersonalMessageManager()
})
- describe('#getMsgList', function() {
- it('when new should return empty array', function() {
+ describe('#getMsgList', function () {
+ it('when new should return empty array', function () {
var result = messageManager.messages
assert.ok(Array.isArray(result))
assert.equal(result.length, 0)
})
- it('should also return transactions from local storage if any', function() {
+ it('should also return transactions from local storage if any', function () {
})
})
- describe('#addMsg', function() {
- it('adds a Msg returned in getMsgList', function() {
+ describe('#addMsg', function () {
+ it('adds a Msg returned in getMsgList', function () {
var Msg = { id: 1, status: 'approved', metamaskNetworkId: 'unit test' }
messageManager.addMsg(Msg)
var result = messageManager.messages
@@ -33,8 +31,8 @@ describe('Personal Message Manager', function() {
})
})
- describe('#setMsgStatusApproved', function() {
- it('sets the Msg status to approved', function() {
+ describe('#setMsgStatusApproved', function () {
+ it('sets the Msg status to approved', function () {
var Msg = { id: 1, status: 'unapproved', metamaskNetworkId: 'unit test' }
messageManager.addMsg(Msg)
messageManager.setMsgStatusApproved(1)
@@ -45,8 +43,8 @@ describe('Personal Message Manager', function() {
})
})
- describe('#rejectMsg', function() {
- it('sets the Msg status to rejected', function() {
+ describe('#rejectMsg', function () {
+ it('sets the Msg status to rejected', function () {
var Msg = { id: 1, status: 'unapproved', metamaskNetworkId: 'unit test' }
messageManager.addMsg(Msg)
messageManager.rejectMsg(1)
@@ -57,8 +55,8 @@ describe('Personal Message Manager', function() {
})
})
- describe('#_updateMsg', function() {
- it('replaces the Msg with the same id', function() {
+ describe('#_updateMsg', function () {
+ it('replaces the Msg with the same id', function () {
messageManager.addMsg({ id: '1', status: 'unapproved', metamaskNetworkId: 'unit test' })
messageManager.addMsg({ id: '2', status: 'approved', metamaskNetworkId: 'unit test' })
messageManager._updateMsg({ id: '1', status: 'blah', hash: 'foo', metamaskNetworkId: 'unit test' })
@@ -67,19 +65,19 @@ describe('Personal Message Manager', function() {
})
})
- describe('#getUnapprovedMsgs', function() {
- it('returns unapproved Msgs in a hash', function() {
+ describe('#getUnapprovedMsgs', function () {
+ it('returns unapproved Msgs in a hash', function () {
messageManager.addMsg({ id: '1', status: 'unapproved', metamaskNetworkId: 'unit test' })
messageManager.addMsg({ id: '2', status: 'approved', metamaskNetworkId: 'unit test' })
- let result = messageManager.getUnapprovedMsgs()
+ const result = messageManager.getUnapprovedMsgs()
assert.equal(typeof result, 'object')
assert.equal(result['1'].status, 'unapproved')
assert.equal(result['2'], undefined)
})
})
- describe('#getMsg', function() {
- it('returns a Msg with the requested id', function() {
+ describe('#getMsg', function () {
+ it('returns a Msg with the requested id', function () {
messageManager.addMsg({ id: '1', status: 'unapproved', metamaskNetworkId: 'unit test' })
messageManager.addMsg({ id: '2', status: 'approved', metamaskNetworkId: 'unit test' })
assert.equal(messageManager.getMsg('1').status, 'unapproved')
@@ -87,24 +85,23 @@ describe('Personal Message Manager', function() {
})
})
- describe('#normalizeMsgData', function() {
- it('converts text to a utf8 hex string', function() {
+ describe('#normalizeMsgData', function () {
+ it('converts text to a utf8 hex string', function () {
var input = 'hello'
var output = messageManager.normalizeMsgData(input)
assert.equal(output, '0x68656c6c6f', 'predictably hex encoded')
})
- it('tolerates a hex prefix', function() {
+ it('tolerates a hex prefix', function () {
var input = '0x12'
var output = messageManager.normalizeMsgData(input)
assert.equal(output, '0x12', 'un modified')
})
- it('tolerates normal hex', function() {
+ it('tolerates normal hex', function () {
var input = '12'
var output = messageManager.normalizeMsgData(input)
assert.equal(output, '0x12', 'adds prefix')
})
})
-
})
diff --git a/test/unit/reducers/unlock_vault_test.js b/test/unit/reducers/unlock_vault_test.js
index b7540af08..2b7d70b2c 100644
--- a/test/unit/reducers/unlock_vault_test.js
+++ b/test/unit/reducers/unlock_vault_test.js
@@ -1,32 +1,31 @@
-var jsdom = require('mocha-jsdom')
+// var jsdom = require('mocha-jsdom')
var assert = require('assert')
-var freeze = require('deep-freeze-strict')
+// var freeze = require('deep-freeze-strict')
var path = require('path')
var sinon = require('sinon')
var actions = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'actions.js'))
-var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
+var reducers = require(path.join(__dirname, '..', '..', '..', 'ui', 'app', 'reducers.js'))
-describe('#unlockMetamask(selectedAccount)', function() {
-
- beforeEach(function() {
+describe('#unlockMetamask(selectedAccount)', function () {
+ beforeEach(function () {
// sinon allows stubbing methods that are easily verified
this.sinon = sinon.sandbox.create()
})
- afterEach(function() {
+ afterEach(function () {
// sinon requires cleanup otherwise it will overwrite context
this.sinon.restore()
})
- describe('after an error', function() {
- it('clears warning', function() {
+ describe('after an error', function () {
+ it('clears warning', function () {
const warning = 'this is the wrong warning'
const account = 'foo_account'
const initialState = {
appState: {
warning: warning,
- }
+ },
}
const resultState = reducers(initialState, actions.unlockMetamask(account))
@@ -34,14 +33,14 @@ describe('#unlockMetamask(selectedAccount)', function() {
})
})
- describe('going home after an error', function() {
- it('clears warning', function() {
+ describe('going home after an error', function () {
+ it('clears warning', function () {
const warning = 'this is the wrong warning'
- const account = 'foo_account'
+ // const account = 'foo_account'
const initialState = {
appState: {
warning: warning,
- }
+ },
}
const resultState = reducers(initialState, actions.goHome())
diff --git a/test/unit/tx-controller-test.js b/test/unit/tx-controller-test.js
new file mode 100644
index 000000000..3954300a8
--- /dev/null
+++ b/test/unit/tx-controller-test.js
@@ -0,0 +1,323 @@
+const assert = require('assert')
+const EventEmitter = require('events')
+const ethUtil = require('ethereumjs-util')
+const EthTx = require('ethereumjs-tx')
+const EthQuery = require('eth-query')
+const ObservableStore = require('obs-store')
+const clone = require('clone')
+const sinon = require('sinon')
+const TransactionController = require('../../app/scripts/controllers/transactions')
+const noop = () => true
+const currentNetworkId = 42
+const otherNetworkId = 36
+const privKey = new Buffer('8718b9618a37d1fc78c436511fc6df3c8258d3250635bba617f33003270ec03e', 'hex')
+
+describe('Transaction Controller', function () {
+ let txController
+
+ beforeEach(function () {
+ txController = new TransactionController({
+ networkStore: new ObservableStore(currentNetworkId),
+ txHistoryLimit: 10,
+ blockTracker: new EventEmitter(),
+ ethQuery: new EthQuery(new EventEmitter()),
+ signTransaction: (ethTx) => new Promise((resolve) => {
+ ethTx.sign(privKey)
+ resolve()
+ }),
+ })
+ })
+
+ describe('#validateTxParams', function () {
+ it('returns null for positive values', function () {
+ var sample = {
+ value: '0x01',
+ }
+ txController.txProviderUtils.validateTxParams(sample, (err) => {
+ assert.equal(err, null, 'no error')
+ })
+ })
+
+ it('returns error for negative values', function () {
+ var sample = {
+ value: '-0x01',
+ }
+ txController.txProviderUtils.validateTxParams(sample, (err) => {
+ assert.ok(err, 'error')
+ })
+ })
+ })
+
+ describe('#getTxList', function () {
+ it('when new should return empty array', function () {
+ var result = txController.getTxList()
+ assert.ok(Array.isArray(result))
+ assert.equal(result.length, 0)
+ })
+ it('should also return transactions from local storage if any', function () {
+
+ })
+ })
+
+ describe('#addTx', function () {
+ it('adds a tx returned in getTxList', function () {
+ var tx = { id: 1, status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }
+ txController.addTx(tx, noop)
+ var result = txController.getTxList()
+ assert.ok(Array.isArray(result))
+ assert.equal(result.length, 1)
+ assert.equal(result[0].id, 1)
+ })
+
+ it('does not override txs from other networks', function () {
+ var tx = { id: 1, status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }
+ var tx2 = { id: 2, status: 'confirmed', metamaskNetworkId: otherNetworkId, txParams: {} }
+ txController.addTx(tx, noop)
+ txController.addTx(tx2, noop)
+ var result = txController.getFullTxList()
+ var result2 = txController.getTxList()
+ assert.equal(result.length, 2, 'txs were deleted')
+ assert.equal(result2.length, 1, 'incorrect number of txs on network.')
+ })
+
+ it('cuts off early txs beyond a limit', function () {
+ const limit = txController.txHistoryLimit
+ for (let i = 0; i < limit + 1; i++) {
+ const tx = { id: i, time: new Date(), status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }
+ txController.addTx(tx, noop)
+ }
+ var result = txController.getTxList()
+ assert.equal(result.length, limit, `limit of ${limit} txs enforced`)
+ assert.equal(result[0].id, 1, 'early txs truncted')
+ })
+
+ it('cuts off early txs beyond a limit whether or not it is confirmed or rejected', function () {
+ const limit = txController.txHistoryLimit
+ for (let i = 0; i < limit + 1; i++) {
+ const tx = { id: i, time: new Date(), status: 'rejected', metamaskNetworkId: currentNetworkId, txParams: {} }
+ txController.addTx(tx, noop)
+ }
+ var result = txController.getTxList()
+ assert.equal(result.length, limit, `limit of ${limit} txs enforced`)
+ assert.equal(result[0].id, 1, 'early txs truncted')
+ })
+
+ it('cuts off early txs beyond a limit but does not cut unapproved txs', function () {
+ var unconfirmedTx = { id: 0, time: new Date(), status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
+ txController.addTx(unconfirmedTx, noop)
+ const limit = txController.txHistoryLimit
+ for (let i = 1; i < limit + 1; i++) {
+ const tx = { id: i, time: new Date(), status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }
+ txController.addTx(tx, noop)
+ }
+ var result = txController.getTxList()
+ assert.equal(result.length, limit, `limit of ${limit} txs enforced`)
+ assert.equal(result[0].id, 0, 'first tx should still be there')
+ assert.equal(result[0].status, 'unapproved', 'first tx should be unapproved')
+ assert.equal(result[1].id, 2, 'early txs truncted')
+ })
+ })
+
+ describe('#setTxStatusSigned', function () {
+ it('sets the tx status to signed', function () {
+ var tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
+ txController.addTx(tx, noop)
+ txController.setTxStatusSigned(1)
+ var result = txController.getTxList()
+ assert.ok(Array.isArray(result))
+ assert.equal(result.length, 1)
+ assert.equal(result[0].status, 'signed')
+ })
+
+ it('should emit a signed event to signal the exciton of callback', (done) => {
+ this.timeout(10000)
+ var tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
+ const noop = function () {
+ assert(true, 'event listener has been triggered and noop executed')
+ done()
+ }
+ txController.addTx(tx)
+ txController.on('1:signed', noop)
+ txController.setTxStatusSigned(1)
+ })
+ })
+
+ describe('#setTxStatusRejected', function () {
+ it('sets the tx status to rejected', function () {
+ var tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
+ txController.addTx(tx)
+ txController.setTxStatusRejected(1)
+ var result = txController.getTxList()
+ assert.ok(Array.isArray(result))
+ assert.equal(result.length, 1)
+ assert.equal(result[0].status, 'rejected')
+ })
+
+ it('should emit a rejected event to signal the exciton of callback', (done) => {
+ this.timeout(10000)
+ var tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
+ txController.addTx(tx)
+ const noop = function (err, txId) {
+ assert(true, 'event listener has been triggered and noop executed')
+ done()
+ }
+ txController.on('1:rejected', noop)
+ txController.setTxStatusRejected(1)
+ })
+ })
+
+ describe('#updateTx', function () {
+ it('replaces the tx with the same id', function () {
+ txController.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
+ txController.addTx({ id: '2', status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
+ txController.updateTx({ id: '1', status: 'blah', hash: 'foo', metamaskNetworkId: currentNetworkId, txParams: {} })
+ var result = txController.getTx('1')
+ assert.equal(result.hash, 'foo')
+ })
+
+ it('updates gas price', function () {
+ const originalGasPrice = '0x01'
+ const desiredGasPrice = '0x02'
+
+ const txMeta = {
+ id: '1',
+ status: 'unapproved',
+ metamaskNetworkId: currentNetworkId,
+ txParams: {
+ gasPrice: originalGasPrice,
+ },
+ }
+
+ const updatedMeta = clone(txMeta)
+
+ txController.addTx(txMeta)
+ updatedMeta.txParams.gasPrice = desiredGasPrice
+ txController.updateTx(updatedMeta)
+ var result = txController.getTx('1')
+ assert.equal(result.txParams.gasPrice, desiredGasPrice, 'gas price updated')
+ })
+ })
+
+ describe('#getUnapprovedTxList', function () {
+ it('returns unapproved txs in a hash', function () {
+ txController.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
+ txController.addTx({ id: '2', status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
+ const result = txController.getUnapprovedTxList()
+ assert.equal(typeof result, 'object')
+ assert.equal(result['1'].status, 'unapproved')
+ assert.equal(result['2'], undefined)
+ })
+ })
+
+ describe('#getTx', function () {
+ it('returns a tx with the requested id', function () {
+ txController.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
+ txController.addTx({ id: '2', status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
+ assert.equal(txController.getTx('1').status, 'unapproved')
+ assert.equal(txController.getTx('2').status, 'confirmed')
+ })
+ })
+
+ describe('#getFilteredTxList', function () {
+ it('returns a tx with the requested data', function () {
+ const txMetas = [
+ { id: 0, status: 'unapproved', txParams: { from: '0xaa', to: '0xbb' }, metamaskNetworkId: currentNetworkId },
+ { id: 1, status: 'unapproved', txParams: { from: '0xaa', to: '0xbb' }, metamaskNetworkId: currentNetworkId },
+ { id: 2, status: 'unapproved', txParams: { from: '0xaa', to: '0xbb' }, metamaskNetworkId: currentNetworkId },
+ { id: 3, status: 'unapproved', txParams: { from: '0xbb', to: '0xaa' }, metamaskNetworkId: currentNetworkId },
+ { id: 4, status: 'unapproved', txParams: { from: '0xbb', to: '0xaa' }, metamaskNetworkId: currentNetworkId },
+ { id: 5, status: 'confirmed', txParams: { from: '0xaa', to: '0xbb' }, metamaskNetworkId: currentNetworkId },
+ { id: 6, status: 'confirmed', txParams: { from: '0xaa', to: '0xbb' }, metamaskNetworkId: currentNetworkId },
+ { id: 7, status: 'confirmed', txParams: { from: '0xbb', to: '0xaa' }, metamaskNetworkId: currentNetworkId },
+ { id: 8, status: 'confirmed', txParams: { from: '0xbb', to: '0xaa' }, metamaskNetworkId: currentNetworkId },
+ { id: 9, status: 'confirmed', txParams: { from: '0xbb', to: '0xaa' }, metamaskNetworkId: currentNetworkId },
+ ]
+ txMetas.forEach((txMeta) => txController.addTx(txMeta, noop))
+ let filterParams
+
+ filterParams = { status: 'unapproved', from: '0xaa' }
+ assert.equal(txController.getFilteredTxList(filterParams).length, 3, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
+ filterParams = { status: 'unapproved', to: '0xaa' }
+ assert.equal(txController.getFilteredTxList(filterParams).length, 2, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
+ filterParams = { status: 'confirmed', from: '0xbb' }
+ assert.equal(txController.getFilteredTxList(filterParams).length, 3, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
+ filterParams = { status: 'confirmed' }
+ assert.equal(txController.getFilteredTxList(filterParams).length, 5, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
+ filterParams = { from: '0xaa' }
+ assert.equal(txController.getFilteredTxList(filterParams).length, 5, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
+ filterParams = { to: '0xaa' }
+ assert.equal(txController.getFilteredTxList(filterParams).length, 5, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
+ })
+ })
+
+ describe('#approveTransaction', function () {
+ let txMeta, originalValue
+
+ beforeEach(function () {
+ originalValue = '0x01'
+ txMeta = {
+ id: '1',
+ status: 'unapproved',
+ metamaskNetworkId: currentNetworkId,
+ txParams: {
+ nonce: originalValue,
+ gas: originalValue,
+ gasPrice: originalValue,
+ },
+ }
+ })
+
+
+ it('does not overwrite set values', function (done) {
+ const wrongValue = '0x05'
+
+ txController.addTx(txMeta)
+
+ const estimateStub = sinon.stub(txController.txProviderUtils.query, 'estimateGas')
+ .callsArgWith(1, null, wrongValue)
+
+ const priceStub = sinon.stub(txController.txProviderUtils.query, 'gasPrice')
+ .callsArgWith(0, null, wrongValue)
+
+ const nonceStub = sinon.stub(txController.txProviderUtils.query, 'getTransactionCount')
+ .callsArgWith(2, null, wrongValue)
+
+ const signStub = sinon.stub(txController, 'signTransaction')
+ .callsArgWith(1, null, noop)
+
+ const pubStub = sinon.stub(txController.txProviderUtils, 'publishTransaction')
+ .callsArgWith(1, null, originalValue)
+
+ txController.approveTransaction(txMeta.id, (err) => {
+ assert.ifError(err, 'should not error')
+
+ const result = txController.getTx(txMeta.id)
+ const params = result.txParams
+
+ assert.equal(params.gas, originalValue, 'gas unmodified')
+ assert.equal(params.gasPrice, originalValue, 'gas price unmodified')
+ assert.equal(params.nonce, originalValue, 'nonce unmodified')
+ assert.equal(result.hash, originalValue, 'hash was set')
+
+ estimateStub.restore()
+ priceStub.restore()
+ signStub.restore()
+ nonceStub.restore()
+ pubStub.restore()
+
+ done()
+ })
+ })
+ })
+
+ describe('#sign replay-protected tx', function () {
+ it('prepares a tx with the chainId set', function () {
+ txController.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
+ txController.signTransaction('1', (err, rawTx) => {
+ if (err) return assert.fail('it should not fail')
+ const ethTx = new EthTx(ethUtil.toBuffer(rawTx))
+ assert.equal(ethTx.getChainId(), currentNetworkId)
+ })
+ })
+ })
+})
diff --git a/test/unit/tx-manager-test.js b/test/unit/tx-manager-test.js
deleted file mode 100644
index 21e94357b..000000000
--- a/test/unit/tx-manager-test.js
+++ /dev/null
@@ -1,241 +0,0 @@
-const assert = require('assert')
-const extend = require('xtend')
-const EventEmitter = require('events')
-const ethUtil = require('ethereumjs-util')
-const EthTx = require('ethereumjs-tx')
-const ObservableStore = require('obs-store')
-const STORAGE_KEY = 'metamask-persistance-key'
-const TransactionManager = require('../../app/scripts/transaction-manager')
-const noop = () => true
-const currentNetworkId = 42
-const otherNetworkId = 36
-const privKey = new Buffer('8718b9618a37d1fc78c436511fc6df3c8258d3250635bba617f33003270ec03e', 'hex')
-
-describe('Transaction Manager', function() {
- let txManager
-
- beforeEach(function() {
- txManager = new TransactionManager({
- networkStore: new ObservableStore({ network: currentNetworkId }),
- txHistoryLimit: 10,
- blockTracker: new EventEmitter(),
- signTransaction: (ethTx) => new Promise((resolve) => {
- ethTx.sign(privKey)
- resolve()
- })
- })
- })
-
- describe('#validateTxParams', function () {
- it('returns null for positive values', function() {
- var sample = {
- value: '0x01'
- }
- var res = txManager.txProviderUtils.validateTxParams(sample, (err) => {
- assert.equal(err, null, 'no error')
- })
- })
-
- it('returns error for negative values', function() {
- var sample = {
- value: '-0x01'
- }
- var res = txManager.txProviderUtils.validateTxParams(sample, (err) => {
- assert.ok(err, 'error')
- })
- })
- })
-
- describe('#getTxList', function() {
- it('when new should return empty array', function() {
- var result = txManager.getTxList()
- assert.ok(Array.isArray(result))
- assert.equal(result.length, 0)
- })
- it('should also return transactions from local storage if any', function() {
-
- })
- })
-
- describe('#addTx', function() {
- it('adds a tx returned in getTxList', function() {
- var tx = { id: 1, status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(tx, noop)
- var result = txManager.getTxList()
- assert.ok(Array.isArray(result))
- assert.equal(result.length, 1)
- assert.equal(result[0].id, 1)
- })
-
- it('does not override txs from other networks', function() {
- var tx = { id: 1, status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }
- var tx2 = { id: 2, status: 'confirmed', metamaskNetworkId: otherNetworkId, txParams: {} }
- txManager.addTx(tx, noop)
- txManager.addTx(tx2, noop)
- var result = txManager.getFullTxList()
- var result2 = txManager.getTxList()
- assert.equal(result.length, 2, 'txs were deleted')
- assert.equal(result2.length, 1, 'incorrect number of txs on network.')
- })
-
- it('cuts off early txs beyond a limit', function() {
- const limit = txManager.txHistoryLimit
- for (let i = 0; i < limit + 1; i++) {
- let tx = { id: i, time: new Date(), status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(tx, noop)
- }
- var result = txManager.getTxList()
- assert.equal(result.length, limit, `limit of ${limit} txs enforced`)
- assert.equal(result[0].id, 1, 'early txs truncted')
- })
-
- it('cuts off early txs beyond a limit whether or not it is confirmed or rejected', function() {
- const limit = txManager.txHistoryLimit
- for (let i = 0; i < limit + 1; i++) {
- let tx = { id: i, time: new Date(), status: 'rejected', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(tx, noop)
- }
- var result = txManager.getTxList()
- assert.equal(result.length, limit, `limit of ${limit} txs enforced`)
- assert.equal(result[0].id, 1, 'early txs truncted')
- })
-
- it('cuts off early txs beyond a limit but does not cut unapproved txs', function() {
- var unconfirmedTx = { id: 0, time: new Date(), status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(unconfirmedTx, noop)
- const limit = txManager.txHistoryLimit
- for (let i = 1; i < limit + 1; i++) {
- let tx = { id: i, time: new Date(), status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(tx, noop)
- }
- var result = txManager.getTxList()
- assert.equal(result.length, limit, `limit of ${limit} txs enforced`)
- assert.equal(result[0].id, 0, 'first tx should still be there')
- assert.equal(result[0].status, 'unapproved', 'first tx should be unapproved')
- assert.equal(result[1].id, 2, 'early txs truncted')
- })
- })
-
- describe('#setTxStatusSigned', function() {
- it('sets the tx status to signed', function() {
- var tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(tx, noop)
- txManager.setTxStatusSigned(1)
- var result = txManager.getTxList()
- assert.ok(Array.isArray(result))
- assert.equal(result.length, 1)
- assert.equal(result[0].status, 'signed')
- })
-
- it('should emit a signed event to signal the exciton of callback', (done) => {
- this.timeout(10000)
- var tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
- let noop = function () {
- assert(true, 'event listener has been triggered and noop executed')
- done()
- }
- txManager.addTx(tx)
- txManager.on('1:signed', noop)
- txManager.setTxStatusSigned(1)
- })
- })
-
- describe('#setTxStatusRejected', function() {
- it('sets the tx status to rejected', function() {
- var tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(tx)
- txManager.setTxStatusRejected(1)
- var result = txManager.getTxList()
- assert.ok(Array.isArray(result))
- assert.equal(result.length, 1)
- assert.equal(result[0].status, 'rejected')
- })
-
- it('should emit a rejected event to signal the exciton of callback', (done) => {
- this.timeout(10000)
- var tx = { id: 1, status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }
- txManager.addTx(tx)
- let noop = function (err, txId) {
- assert(true, 'event listener has been triggered and noop executed')
- done()
- }
- txManager.on('1:rejected', noop)
- txManager.setTxStatusRejected(1)
- })
-
- })
-
- describe('#updateTx', function() {
- it('replaces the tx with the same id', function() {
- txManager.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
- txManager.addTx({ id: '2', status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
- txManager.updateTx({ id: '1', status: 'blah', hash: 'foo', metamaskNetworkId: currentNetworkId, txParams: {} })
- var result = txManager.getTx('1')
- assert.equal(result.hash, 'foo')
- })
- })
-
- describe('#getUnapprovedTxList', function() {
- it('returns unapproved txs in a hash', function() {
- txManager.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
- txManager.addTx({ id: '2', status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
- let result = txManager.getUnapprovedTxList()
- assert.equal(typeof result, 'object')
- assert.equal(result['1'].status, 'unapproved')
- assert.equal(result['2'], undefined)
- })
- })
-
- describe('#getTx', function() {
- it('returns a tx with the requested id', function() {
- txManager.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
- txManager.addTx({ id: '2', status: 'confirmed', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
- assert.equal(txManager.getTx('1').status, 'unapproved')
- assert.equal(txManager.getTx('2').status, 'confirmed')
- })
- })
-
- describe('#getFilteredTxList', function() {
- it('returns a tx with the requested data', function() {
- let txMetas = [
- { id: 0, status: 'unapproved', txParams: { from: '0xaa', to: '0xbb' }, metamaskNetworkId: currentNetworkId },
- { id: 1, status: 'unapproved', txParams: { from: '0xaa', to: '0xbb' }, metamaskNetworkId: currentNetworkId },
- { id: 2, status: 'unapproved', txParams: { from: '0xaa', to: '0xbb' }, metamaskNetworkId: currentNetworkId },
- { id: 3, status: 'unapproved', txParams: { from: '0xbb', to: '0xaa' }, metamaskNetworkId: currentNetworkId },
- { id: 4, status: 'unapproved', txParams: { from: '0xbb', to: '0xaa' }, metamaskNetworkId: currentNetworkId },
- { id: 5, status: 'confirmed', txParams: { from: '0xaa', to: '0xbb' }, metamaskNetworkId: currentNetworkId },
- { id: 6, status: 'confirmed', txParams: { from: '0xaa', to: '0xbb' }, metamaskNetworkId: currentNetworkId },
- { id: 7, status: 'confirmed', txParams: { from: '0xbb', to: '0xaa' }, metamaskNetworkId: currentNetworkId },
- { id: 8, status: 'confirmed', txParams: { from: '0xbb', to: '0xaa' }, metamaskNetworkId: currentNetworkId },
- { id: 9, status: 'confirmed', txParams: { from: '0xbb', to: '0xaa' }, metamaskNetworkId: currentNetworkId },
- ]
- txMetas.forEach((txMeta) => txManager.addTx(txMeta, noop))
- let filterParams
-
- filterParams = { status: 'unapproved', from: '0xaa' }
- assert.equal(txManager.getFilteredTxList(filterParams).length, 3, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
- filterParams = { status: 'unapproved', to: '0xaa' }
- assert.equal(txManager.getFilteredTxList(filterParams).length, 2, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
- filterParams = { status: 'confirmed', from: '0xbb' }
- assert.equal(txManager.getFilteredTxList(filterParams).length, 3, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
- filterParams = { status: 'confirmed' }
- assert.equal(txManager.getFilteredTxList(filterParams).length, 5, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
- filterParams = { from: '0xaa' }
- assert.equal(txManager.getFilteredTxList(filterParams).length, 5, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
- filterParams = { to: '0xaa' }
- assert.equal(txManager.getFilteredTxList(filterParams).length, 5, `getFilteredTxList - ${JSON.stringify(filterParams)}`)
- })
- })
-
- describe('#sign replay-protected tx', function() {
- it('prepares a tx with the chainId set', function() {
- txManager.addTx({ id: '1', status: 'unapproved', metamaskNetworkId: currentNetworkId, txParams: {} }, noop)
- txManager.signTransaction('1', (err, rawTx) => {
- if (err) return assert.fail('it should not fail')
- const ethTx = new EthTx(ethUtil.toBuffer(rawTx))
- assert.equal(ethTx.getChainId(), currentNetworkId)
- })
- })
- })
-
-})
diff --git a/test/unit/tx-utils-test.js b/test/unit/tx-utils-test.js
index 93e9e4134..7ace1f587 100644
--- a/test/unit/tx-utils-test.js
+++ b/test/unit/tx-utils-test.js
@@ -5,15 +5,19 @@ const BN = ethUtil.BN
const TxUtils = require('../../app/scripts/lib/tx-utils')
-describe('txUtils', function() {
+describe('txUtils', function () {
let txUtils
- before(function() {
- txUtils = new TxUtils()
+ before(function () {
+ txUtils = new TxUtils(new Proxy({}, {
+ get: (obj, name) => {
+ return () => {}
+ },
+ }))
})
- describe('chain Id', function() {
- it('prepares a transaction with the provided chainId', function() {
+ describe('chain Id', function () {
+ it('prepares a transaction with the provided chainId', function () {
const txParams = {
to: '0x70ad465e0bab6504002ad58c744ed89c7da38524',
from: '0x69ad465e0bab6504002ad58c744ed89c7da38525',
@@ -29,8 +33,8 @@ describe('txUtils', function() {
})
})
- describe('addGasBuffer', function() {
- it('multiplies by 1.5, when within block gas limit', function() {
+ describe('addGasBuffer', function () {
+ it('multiplies by 1.5, when within block gas limit', function () {
// naive estimatedGas: 0x16e360 (1.5 mil)
const inputHex = '0x16e360'
// dummy gas limit: 0x3d4c52 (4 mil)
@@ -41,20 +45,20 @@ describe('txUtils', function() {
const expectedBn = inputBn.muln(1.5)
assert(outputBn.eq(expectedBn), 'returns 1.5 the input value')
})
-
- it('uses original estimatedGas, when above block gas limit', function() {
+
+ it('uses original estimatedGas, when above block gas limit', function () {
// naive estimatedGas: 0x16e360 (1.5 mil)
const inputHex = '0x16e360'
// dummy gas limit: 0x0f4240 (1 mil)
const blockGasLimitHex = '0x0f4240'
const output = txUtils.addGasBuffer(inputHex, blockGasLimitHex)
- const inputBn = hexToBn(inputHex)
+ // const inputBn = hexToBn(inputHex)
const outputBn = hexToBn(output)
const expectedBn = hexToBn(inputHex)
assert(outputBn.eq(expectedBn), 'returns the original estimatedGas value')
})
- it('buffers up to reccomend gas limit reccomended ceiling', function() {
+ it('buffers up to reccomend gas limit reccomended ceiling', function () {
// naive estimatedGas: 0x16e360 (1.5 mil)
const inputHex = '0x16e360'
// dummy gas limit: 0x1e8480 (2 mil)
@@ -72,10 +76,10 @@ describe('txUtils', function() {
// util
-function hexToBn(inputHex) {
+function hexToBn (inputHex) {
return new BN(ethUtil.stripHexPrefix(inputHex), 16)
}
-function bnToHex(inputBn) {
+function bnToHex (inputBn) {
return ethUtil.addHexPrefix(inputBn.toString(16))
-} \ No newline at end of file
+}
diff --git a/test/unit/util_test.js b/test/unit/util_test.js
index 00528b905..3a8b6bdfd 100644
--- a/test/unit/util_test.js
+++ b/test/unit/util_test.js
@@ -5,96 +5,96 @@ const ethUtil = require('ethereumjs-util')
var path = require('path')
var util = require(path.join(__dirname, '..', '..', 'ui', 'app', 'util.js'))
-describe('util', function() {
+describe('util', function () {
var ethInWei = '1'
- for (var i = 0; i < 18; i++ ) { ethInWei += '0' }
+ for (var i = 0; i < 18; i++) { ethInWei += '0' }
- beforeEach(function() {
+ beforeEach(function () {
this.sinon = sinon.sandbox.create()
})
- afterEach(function() {
+ afterEach(function () {
this.sinon.restore()
})
- describe('#parseBalance', function() {
- it('should render 0.01 eth correctly', function() {
+ describe('#parseBalance', function () {
+ it('should render 0.01 eth correctly', function () {
const input = '0x2386F26FC10000'
const output = util.parseBalance(input)
assert.deepEqual(output, ['0', '01'])
})
- it('should render 12.023 eth correctly', function() {
+ it('should render 12.023 eth correctly', function () {
const input = 'A6DA46CCA6858000'
const output = util.parseBalance(input)
assert.deepEqual(output, ['12', '023'])
})
- it('should render 0.0000000342422 eth correctly', function() {
+ it('should render 0.0000000342422 eth correctly', function () {
const input = '0x7F8FE81C0'
const output = util.parseBalance(input)
assert.deepEqual(output, ['0', '0000000342422'])
})
- it('should render 0 eth correctly', function() {
+ it('should render 0 eth correctly', function () {
const input = '0x0'
const output = util.parseBalance(input)
assert.deepEqual(output, ['0', '0'])
})
})
- describe('#addressSummary', function() {
- it('should add case-sensitive checksum', function() {
+ describe('#addressSummary', function () {
+ it('should add case-sensitive checksum', function () {
var address = '0xfdea65c8e26263f6d9a1b5de9555d2931a33b825'
var result = util.addressSummary(address)
assert.equal(result, '0xFDEa65C8...b825')
})
- it('should accept arguments for firstseg, lastseg, and keepPrefix', function() {
+ it('should accept arguments for firstseg, lastseg, and keepPrefix', function () {
var address = '0xfdea65c8e26263f6d9a1b5de9555d2931a33b825'
var result = util.addressSummary(address, 4, 4, false)
assert.equal(result, 'FDEa...b825')
})
})
- describe('#isValidAddress', function() {
- it('should allow 40-char non-prefixed hex', function() {
+ describe('#isValidAddress', function () {
+ it('should allow 40-char non-prefixed hex', function () {
var address = 'fdea65c8e26263f6d9a1b5de9555d2931a33b825'
var result = util.isValidAddress(address)
assert.ok(result)
})
- it('should allow 42-char non-prefixed hex', function() {
+ it('should allow 42-char non-prefixed hex', function () {
var address = '0xfdea65c8e26263f6d9a1b5de9555d2931a33b825'
var result = util.isValidAddress(address)
assert.ok(result)
})
- it('should not allow less non hex-prefixed', function() {
+ it('should not allow less non hex-prefixed', function () {
var address = 'fdea65c8e26263f6d9a1b5de9555d2931a33b85'
var result = util.isValidAddress(address)
assert.ok(!result)
})
- it('should not allow less hex-prefixed', function() {
+ it('should not allow less hex-prefixed', function () {
var address = '0xfdea65ce26263f6d9a1b5de9555d2931a33b85'
var result = util.isValidAddress(address)
assert.ok(!result)
})
- it('should recognize correct capitalized checksum', function() {
+ it('should recognize correct capitalized checksum', function () {
var address = '0xFDEa65C8e26263F6d9A1B5de9555D2931A33b825'
var result = util.isValidAddress(address)
assert.ok(result)
})
- it('should recognize incorrect capitalized checksum', function() {
+ it('should recognize incorrect capitalized checksum', function () {
var address = '0xFDea65C8e26263F6d9A1B5de9555D2931A33b825'
var result = util.isValidAddress(address)
assert.ok(!result)
})
- it('should recognize this sample hashed address', function() {
+ it('should recognize this sample hashed address', function () {
const address = '0x5Fda30Bb72B8Dfe20e48A00dFc108d0915BE9Bb0'
const result = util.isValidAddress(address)
const hashed = ethUtil.toChecksumAddress(address.toLowerCase())
@@ -103,60 +103,57 @@ describe('util', function() {
})
})
- describe('#numericBalance', function() {
-
- it('should return a BN 0 if given nothing', function() {
+ describe('#numericBalance', function () {
+ it('should return a BN 0 if given nothing', function () {
var result = util.numericBalance()
assert.equal(result.toString(10), 0)
})
- it('should work with hex prefix', function() {
+ it('should work with hex prefix', function () {
var result = util.numericBalance('0x012')
assert.equal(result.toString(10), '18')
})
- it('should work with no hex prefix', function() {
+ it('should work with no hex prefix', function () {
var result = util.numericBalance('012')
assert.equal(result.toString(10), '18')
})
-
})
- describe('#formatBalance', function() {
-
- it('when given nothing', function() {
+ describe('#formatBalance', function () {
+ it('when given nothing', function () {
var result = util.formatBalance()
assert.equal(result, 'None', 'should return "None"')
})
- it('should return eth as string followed by ETH', function() {
+ it('should return eth as string followed by ETH', function () {
var input = new ethUtil.BN(ethInWei, 10).toJSON()
var result = util.formatBalance(input, 4)
assert.equal(result, '1.0000 ETH')
})
- it('should return eth as string followed by ETH', function() {
+ it('should return eth as string followed by ETH', function () {
var input = new ethUtil.BN(ethInWei, 10).div(new ethUtil.BN('2', 10)).toJSON()
var result = util.formatBalance(input, 3)
assert.equal(result, '0.500 ETH')
})
- it('should display specified decimal points', function() {
- var input = "0x128dfa6a90b28000"
+ it('should display specified decimal points', function () {
+ var input = '0x128dfa6a90b28000'
var result = util.formatBalance(input, 2)
assert.equal(result, '1.33 ETH')
})
- it('should default to 3 decimal points', function() {
- var input = "0x128dfa6a90b28000"
+ it('should default to 3 decimal points', function () {
+ var input = '0x128dfa6a90b28000'
var result = util.formatBalance(input)
assert.equal(result, '1.337 ETH')
})
- it('should show 2 significant digits for tiny balances', function() {
- var input = "0x1230fa6a90b28"
+ it('should show 2 significant digits for tiny balances', function () {
+ var input = '0x1230fa6a90b28'
var result = util.formatBalance(input)
assert.equal(result, '0.00032 ETH')
})
- it('should not parse the balance and return value with 2 decimal points with ETH at the end', function() {
+ it('should not parse the balance and return value with 2 decimal points with ETH at the end', function () {
var value = '1.2456789'
var needsParse = false
var result = util.formatBalance(value, 2, needsParse)
@@ -164,17 +161,16 @@ describe('util', function() {
})
})
- describe('normalizing values', function() {
-
- describe('#normalizeToWei', function() {
- it('should convert an eth to the appropriate equivalent values', function() {
+ describe('normalizing values', function () {
+ describe('#normalizeToWei', function () {
+ it('should convert an eth to the appropriate equivalent values', function () {
var valueTable = {
- wei: '1000000000000000000',
- kwei: '1000000000000000',
- mwei: '1000000000000',
- gwei: '1000000000',
+ wei: '1000000000000000000',
+ kwei: '1000000000000000',
+ mwei: '1000000000000',
+ gwei: '1000000000',
szabo: '1000000',
- finney:'1000',
+ finney: '1000',
ether: '1',
// kether:'0.001',
// mether:'0.000001',
@@ -185,8 +181,7 @@ describe('util', function() {
}
var oneEthBn = new ethUtil.BN(ethInWei, 10)
- for(var currency in valueTable) {
-
+ for (var currency in valueTable) {
var value = new ethUtil.BN(valueTable[currency], 10)
var output = util.normalizeToWei(value, currency)
assert.equal(output.toString(10), valueTable.wei, `value of ${output.toString(10)} ${currency} should convert to ${oneEthBn}`)
@@ -194,60 +189,58 @@ describe('util', function() {
})
})
- describe('#normalizeEthStringToWei', function() {
- it('should convert decimal eth to pure wei BN', function() {
+ describe('#normalizeEthStringToWei', function () {
+ it('should convert decimal eth to pure wei BN', function () {
var input = '1.23456789'
var output = util.normalizeEthStringToWei(input)
assert.equal(output.toString(10), '1234567890000000000')
})
- it('should convert 1 to expected wei', function() {
+ it('should convert 1 to expected wei', function () {
var input = '1'
var output = util.normalizeEthStringToWei(input)
assert.equal(output.toString(10), ethInWei)
})
})
- describe('#normalizeNumberToWei', function() {
-
- it('should handle a simple use case', function() {
+ describe('#normalizeNumberToWei', function () {
+ it('should handle a simple use case', function () {
var input = 0.0002
var output = util.normalizeNumberToWei(input, 'ether')
var str = output.toString(10)
assert.equal(str, '200000000000000')
})
- it('should convert a kwei number to the appropriate equivalent wei', function() {
+ it('should convert a kwei number to the appropriate equivalent wei', function () {
var result = util.normalizeNumberToWei(1.111, 'kwei')
assert.equal(result.toString(10), '1111', 'accepts decimals')
})
- it('should convert a ether number to the appropriate equivalent wei', function() {
+ it('should convert a ether number to the appropriate equivalent wei', function () {
var result = util.normalizeNumberToWei(1.111, 'ether')
assert.equal(result.toString(10), '1111000000000000000', 'accepts decimals')
})
})
- describe('#isHex', function(){
- it('should return true when given a hex string', function() {
+ describe('#isHex', function () {
+ it('should return true when given a hex string', function () {
var result = util.isHex('c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2')
assert(result)
})
- it('should return false when given a non-hex string', function() {
+ it('should return false when given a non-hex string', function () {
var result = util.isHex('c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714imnotreal')
assert(!result)
})
- it('should return false when given a string containing a non letter/number character', function() {
+ it('should return false when given a string containing a non letter/number character', function () {
var result = util.isHex('c3ab8ff13720!8ad9047dd39466b3c%8974e592c2fa383d4a396071imnotreal')
assert(!result)
})
- it('should return true when given a hex string with hex-prefix', function() {
+ it('should return true when given a hex string with hex-prefix', function () {
var result = util.isHex('0xc3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2')
assert(result)
})
-
})
})
})
diff --git a/ui/app/account-detail.js b/ui/app/account-detail.js
index 5ceee4fe0..5b2588ec5 100644
--- a/ui/app/account-detail.js
+++ b/ui/app/account-detail.js
@@ -16,9 +16,9 @@ const ExportAccountView = require('./components/account-export')
const ethUtil = require('ethereumjs-util')
const EditableLabel = require('./components/editable-label')
const Tooltip = require('./components/tooltip')
-const BuyButtonSubview = require('./components/buy-button-subview')
const TabBar = require('./components/tab-bar')
const TokenList = require('./components/token-list')
+
module.exports = connect(mapStateToProps)(AccountDetailScreen)
function mapStateToProps (state) {
@@ -32,6 +32,8 @@ function mapStateToProps (state) {
unapprovedMsgs: valuesFor(state.metamask.unapprovedMsgs),
shapeShiftTxList: state.metamask.shapeShiftTxList,
transactions: state.metamask.selectedAddressTxList || [],
+ conversionRate: state.metamask.conversionRate,
+ currentCurrency: state.metamask.currentCurrency,
}
}
@@ -47,7 +49,7 @@ AccountDetailScreen.prototype.render = function () {
var checksumAddress = selected && ethUtil.toChecksumAddress(selected)
var identity = props.identities[selected]
var account = props.accounts[selected]
- const { network } = props
+ const { network, conversionRate, currentCurrency } = props
return (
@@ -186,6 +188,8 @@ AccountDetailScreen.prototype.render = function () {
h(EthBalance, {
value: account && account.balance,
+ conversionRate,
+ currentCurrency,
style: {
lineHeight: '7px',
marginTop: '10px',
@@ -241,8 +245,6 @@ AccountDetailScreen.prototype.subview = function () {
case 'export':
var state = extend({key: 'export'}, this.props)
return h(ExportAccountView, state)
- case 'buyForm':
- return h(BuyButtonSubview, extend({key: 'buyForm'}, this.props))
default:
return this.tabSections()
}
@@ -275,14 +277,6 @@ AccountDetailScreen.prototype.tabSections = function () {
AccountDetailScreen.prototype.tabSwitchView = function () {
const userAddress = this.props.address
- var subview
- try {
- subview = this.props.accountDetail.subview
- return h(TokenList, { userAddress })
- } catch (e) {
- subview = null
- }
-
const tabSelection = this.state.tabSelection || 'history'
switch (tabSelection) {
@@ -294,12 +288,14 @@ AccountDetailScreen.prototype.tabSwitchView = function () {
}
AccountDetailScreen.prototype.transactionList = function () {
+ const {transactions, unapprovedMsgs, address,
+ network, shapeShiftTxList, conversionRate } = this.props
- const {transactions, unapprovedMsgs, address, network, shapeShiftTxList } = this.props
return h(TransactionList, {
transactions: transactions.sort((a, b) => b.time - a.time),
network,
unapprovedMsgs,
+ conversionRate,
address,
shapeShiftTxList,
viewPendingTx: (txId) => {
@@ -311,15 +307,3 @@ AccountDetailScreen.prototype.transactionList = function () {
AccountDetailScreen.prototype.requestAccountExport = function () {
this.props.dispatch(actions.requestExportAccount())
}
-
-
-AccountDetailScreen.prototype.buyButtonDeligator = function () {
- var props = this.props
- var selected = props.address || Object.keys(props.accounts)[0]
-
- if (this.props.accountDetail.subview === 'buyForm') {
- props.dispatch(actions.backToAccountDetail(props.address))
- } else {
- props.dispatch(actions.buyEthView(selected))
- }
-}
diff --git a/ui/app/accounts/account-list-item.js b/ui/app/accounts/account-list-item.js
index 2a3c13d05..10a0b6cc7 100644
--- a/ui/app/accounts/account-list-item.js
+++ b/ui/app/accounts/account-list-item.js
@@ -15,7 +15,8 @@ function AccountListItem () {
}
AccountListItem.prototype.render = function () {
- const { identity, selectedAddress, accounts, onShowDetail } = this.props
+ const { identity, selectedAddress, accounts, onShowDetail,
+ conversionRate, currentCurrency } = this.props
const checksumAddress = identity && identity.address && ethUtil.toChecksumAddress(identity.address)
const isSelected = selectedAddress === identity.address
@@ -52,6 +53,8 @@ AccountListItem.prototype.render = function () {
}, checksumAddress),
h(EthBalance, {
value: account && account.balance,
+ currentCurrency,
+ conversionRate,
style: {
lineHeight: '7px',
marginTop: '10px',
diff --git a/ui/app/accounts/import/index.js b/ui/app/accounts/import/index.js
index 96350852a..a0f0f9bdb 100644
--- a/ui/app/accounts/import/index.js
+++ b/ui/app/accounts/import/index.js
@@ -73,7 +73,7 @@ AccountImportSubview.prototype.render = function () {
)
}
-AccountImportSubview.prototype.renderImportView = function() {
+AccountImportSubview.prototype.renderImportView = function () {
const props = this.props
const state = this.state || {}
const { type } = state
diff --git a/ui/app/accounts/index.js b/ui/app/accounts/index.js
index 9584ebad9..ac2615cd7 100644
--- a/ui/app/accounts/index.js
+++ b/ui/app/accounts/index.js
@@ -23,6 +23,8 @@ function mapStateToProps (state) {
scrollToBottom: state.appState.scrollToBottom,
pending,
keyrings: state.metamask.keyrings,
+ conversionRate: state.metamask.conversionRate,
+ currentCurrency: state.metamask.currentCurrency,
}
}
@@ -33,7 +35,7 @@ function AccountsScreen () {
AccountsScreen.prototype.render = function () {
const props = this.props
- const { keyrings } = props
+ const { keyrings, conversionRate, currentCurrency } = props
const identityList = valuesFor(props.identities)
const unapprovedTxList = valuesFor(props.unapprovedTxs)
@@ -81,6 +83,8 @@ AccountsScreen.prototype.render = function () {
key: `acct-panel-${identity.address}`,
identity,
selectedAddress: this.props.selectedAddress,
+ conversionRate,
+ currentCurrency,
accounts: this.props.accounts,
onShowDetail: this.onShowDetail.bind(this),
pending,
diff --git a/ui/app/actions.js b/ui/app/actions.js
index 8934299e7..1a3557cb4 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -134,10 +134,6 @@ var actions = {
buyEth: buyEth,
buyEthView: buyEthView,
BUY_ETH_VIEW: 'BUY_ETH_VIEW',
- UPDATE_COINBASE_AMOUNT: 'UPDATE_COIBASE_AMOUNT',
- updateCoinBaseAmount: updateCoinBaseAmount,
- UPDATE_BUY_ADDRESS: 'UPDATE_BUY_ADDRESS',
- updateBuyAddress: updateBuyAddress,
COINBASE_SUBVIEW: 'COINBASE_SUBVIEW',
coinBaseSubview: coinBaseSubview,
SHAPESHIFT_SUBVIEW: 'SHAPESHIFT_SUBVIEW',
@@ -318,7 +314,7 @@ function importNewAccount (strategy, args) {
}
}
-function navigateToNewAccountScreen() {
+function navigateToNewAccountScreen () {
return {
type: this.NEW_ACCOUNT_SCREEN,
}
@@ -397,7 +393,7 @@ function signPersonalMsg (msgData) {
function signTx (txData) {
return (dispatch) => {
- web3.eth.sendTransaction(txData, (err, data) => {
+ global.ethQuery.sendTransaction(txData, (err, data) => {
dispatch(actions.hideLoadingIndication())
if (err) return dispatch(actions.displayWarning(err.message))
dispatch(actions.hideWarning())
@@ -669,7 +665,7 @@ function clearNotices () {
}
}
-function markAccountsFound() {
+function markAccountsFound () {
log.debug(`background.markAccountsFound`)
return callBackgroundThenUpdate(background.markAccountsFound)
}
@@ -852,20 +848,6 @@ function buyEthView (address) {
}
}
-function updateCoinBaseAmount (value) {
- return {
- type: actions.UPDATE_COINBASE_AMOUNT,
- value,
- }
-}
-
-function updateBuyAddress (value) {
- return {
- type: actions.UPDATE_BUY_ADDRESS,
- value,
- }
-}
-
function coinBaseSubview () {
return {
type: actions.COINBASE_SUBVIEW,
@@ -996,7 +978,7 @@ function callBackgroundThenUpdate (method, ...args) {
}
}
-function forceUpdateMetamaskState(dispatch){
+function forceUpdateMetamaskState (dispatch) {
log.debug(`background.getState`)
background.getState((err, newState) => {
if (err) {
diff --git a/ui/app/app.js b/ui/app/app.js
index 5a7596aca..53dbc3354 100644
--- a/ui/app/app.js
+++ b/ui/app/app.js
@@ -249,7 +249,7 @@ App.prototype.renderNetworkDropdown = function () {
h(DropMenuItem, {
label: 'Ropsten Test Network',
closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
- action: () => props.dispatch(actions.setProviderType('testnet')),
+ action: () => props.dispatch(actions.setProviderType('ropsten')),
icon: h('.menu-icon.red-dot'),
activeNetworkRender: props.network,
provider: props.provider,
@@ -265,6 +265,15 @@ App.prototype.renderNetworkDropdown = function () {
}),
h(DropMenuItem, {
+ label: 'Rinkeby Test Network',
+ closeMenu: () => this.setState({ isNetworkMenuOpen: false}),
+ action: () => props.dispatch(actions.setProviderType('rinkeby')),
+ icon: h('.menu-icon.golden-square'),
+ activeNetworkRender: props.network,
+ provider: props.provider,
+ }),
+
+ h(DropMenuItem, {
label: 'Localhost 8545',
closeMenu: () => this.setState({ isNetworkMenuOpen: false }),
action: () => props.dispatch(actions.setDefaultRpcTarget(rpcList)),
@@ -332,7 +341,7 @@ App.prototype.renderDropdown = function () {
}),
h(DropMenuItem, {
- label: 'Info',
+ label: 'Info/Help',
closeMenu: () => this.setState({ isMainMenuOpen: !isOpen }),
action: () => this.props.dispatch(actions.showInfoPage()),
icon: h('i.fa.fa-question.fa-lg'),
@@ -552,5 +561,4 @@ App.prototype.renderCommonRpc = function (rpcList, provider) {
})
}
})
-
}
diff --git a/ui/app/components/balance.js b/ui/app/components/balance.js
index 3c5e24b65..57ca84564 100644
--- a/ui/app/components/balance.js
+++ b/ui/app/components/balance.js
@@ -1,7 +1,8 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
-const formatBalance = require('../util').formatBalance const generateBalanceObject = require('../util').generateBalanceObject
+const formatBalance = require('../util').formatBalance
+const generateBalanceObject = require('../util').generateBalanceObject
const Tooltip = require('./tooltip.js')
const FiatValue = require('./fiat-value.js')
diff --git a/ui/app/components/bn-as-decimal-input.js b/ui/app/components/bn-as-decimal-input.js
new file mode 100644
index 000000000..f3ace4720
--- /dev/null
+++ b/ui/app/components/bn-as-decimal-input.js
@@ -0,0 +1,174 @@
+const Component = require('react').Component
+const h = require('react-hyperscript')
+const inherits = require('util').inherits
+const ethUtil = require('ethereumjs-util')
+const BN = ethUtil.BN
+const extend = require('xtend')
+
+module.exports = BnAsDecimalInput
+
+inherits(BnAsDecimalInput, Component)
+function BnAsDecimalInput () {
+ this.state = { invalid: null }
+ Component.call(this)
+}
+
+/* Bn as Decimal Input
+ *
+ * A component for allowing easy, decimal editing
+ * of a passed in bn string value.
+ *
+ * On change, calls back its `onChange` function parameter
+ * and passes it an updated bn string.
+ */
+
+BnAsDecimalInput.prototype.render = function () {
+ const props = this.props
+ const state = this.state
+
+ const { value, scale, precision, onChange, min, max } = props
+
+ const suffix = props.suffix
+ const style = props.style
+ const valueString = value.toString(10)
+ const newValue = this.downsize(valueString, scale, precision)
+
+ return (
+ h('.flex-column', [
+ h('.flex-row', {
+ style: {
+ alignItems: 'flex-end',
+ lineHeight: '13px',
+ fontFamily: 'Montserrat Light',
+ textRendering: 'geometricPrecision',
+ },
+ }, [
+ h('input.hex-input', {
+ type: 'number',
+ step: 'any',
+ required: true,
+ min,
+ max,
+ style: extend({
+ display: 'block',
+ textAlign: 'right',
+ backgroundColor: 'transparent',
+ border: '1px solid #bdbdbd',
+
+ }, style),
+ value: newValue,
+ onBlur: (event) => {
+ this.updateValidity(event)
+ },
+ onChange: (event) => {
+ this.updateValidity(event)
+ const value = (event.target.value === '') ? '' : event.target.value
+
+
+ const scaledNumber = this.upsize(value, scale, precision)
+ const precisionBN = new BN(scaledNumber, 10)
+ onChange(precisionBN, event.target.checkValidity())
+ },
+ onInvalid: (event) => {
+ const msg = this.constructWarning()
+ if (msg === state.invalid) {
+ return
+ }
+ this.setState({ invalid: msg })
+ event.preventDefault()
+ return false
+ },
+ }),
+ h('div', {
+ style: {
+ color: ' #AEAEAE',
+ fontSize: '12px',
+ marginLeft: '5px',
+ marginRight: '6px',
+ width: '20px',
+ },
+ }, suffix),
+ ]),
+
+ state.invalid ? h('span.error', {
+ style: {
+ position: 'absolute',
+ right: '0px',
+ textAlign: 'right',
+ transform: 'translateY(26px)',
+ padding: '3px',
+ background: 'rgba(255,255,255,0.85)',
+ zIndex: '1',
+ textTransform: 'capitalize',
+ border: '2px solid #E20202',
+ },
+ }, state.invalid) : null,
+ ])
+ )
+}
+
+BnAsDecimalInput.prototype.setValid = function (message) {
+ this.setState({ invalid: null })
+}
+
+BnAsDecimalInput.prototype.updateValidity = function (event) {
+ const target = event.target
+ const value = this.props.value
+ const newValue = target.value
+
+ if (value === newValue) {
+ return
+ }
+
+ const valid = target.checkValidity()
+
+ if (valid) {
+ this.setState({ invalid: null })
+ }
+}
+
+BnAsDecimalInput.prototype.constructWarning = function () {
+ const { name, min, max } = this.props
+ let message = name ? name + ' ' : ''
+
+ if (min && max) {
+ message += `must be greater than or equal to ${min} and less than or equal to ${max}.`
+ } else if (min) {
+ message += `must be greater than or equal to ${min}.`
+ } else if (max) {
+ message += `must be less than or equal to ${max}.`
+ } else {
+ message += 'Invalid input.'
+ }
+
+ return message
+}
+
+
+BnAsDecimalInput.prototype.downsize = function (number, scale, precision) {
+ // if there is no scaling, simply return the number
+ if (scale === 0) {
+ return Number(number)
+ } else {
+ // if the scale is the same as the precision, account for this edge case.
+ var decimals = (scale === precision) ? -1 : scale - precision
+ return Number(number.slice(0, -scale) + '.' + number.slice(-scale, decimals))
+ }
+}
+
+BnAsDecimalInput.prototype.upsize = function (number, scale, precision) {
+ var stringArray = number.toString().split('.')
+ var decimalLength = stringArray[1] ? stringArray[1].length : 0
+ var newString = stringArray[0]
+
+ // If there is scaling and decimal parts exist, integrate them in.
+ if ((scale !== 0) && (decimalLength !== 0)) {
+ newString += stringArray[1].slice(0, precision)
+ }
+
+ // Add 0s to account for the upscaling.
+ for (var i = decimalLength; i < scale; i++) {
+ newString += '0'
+ }
+ return newString
+}
diff --git a/ui/app/components/buy-button-subview.js b/ui/app/components/buy-button-subview.js
index 6810303e1..87084f92d 100644
--- a/ui/app/components/buy-button-subview.js
+++ b/ui/app/components/buy-button-subview.js
@@ -6,12 +6,15 @@ const actions = require('../actions')
const CoinbaseForm = require('./coinbase-form')
const ShapeshiftForm = require('./shapeshift-form')
const Loading = require('./loading')
-const TabBar = require('./tab-bar')
+const AccountPanel = require('./account-panel')
+const RadioList = require('./custom-radio-list')
module.exports = connect(mapStateToProps)(BuyButtonSubview)
function mapStateToProps (state) {
return {
+ identity: state.appState.identity,
+ account: state.metamask.accounts[state.appState.buyView.buyAddress],
warning: state.appState.warning,
buyView: state.appState.buyView,
network: state.metamask.network,
@@ -31,7 +34,11 @@ BuyButtonSubview.prototype.render = function () {
const isLoading = props.isSubLoading
return (
- h('.buy-eth-section', [
+ h('.buy-eth-section.flex-column', {
+ style: {
+ alignItems: 'center',
+ },
+ }, [
// back button
h('.flex-row', {
style: {
@@ -46,58 +53,79 @@ BuyButtonSubview.prototype.render = function () {
left: '10px',
},
}),
- h('h2.page-subtitle', 'Buy Eth'),
- ]),
-
- h(Loading, { isLoading }),
-
- h(TabBar, {
- tabs: [
- {
- content: [
- 'Coinbase',
- h('a', {
- onClick: (event) => this.navigateTo('https://github.com/MetaMask/faq/blob/master/COINBASE.md'),
- }, [
- h('i.fa.fa-question-circle', {
- style: {
- margin: '0px 5px',
- },
- }),
- ]),
- ],
- key: 'coinbase',
+ h('h2.text-transform-uppercase.flex-center', {
+ style: {
+ width: '100vw',
+ background: 'rgb(235, 235, 235)',
+ color: 'rgb(174, 174, 174)',
+ paddingTop: '4px',
+ paddingBottom: '4px',
},
- {
- content: [
- 'Shapeshift',
- h('a', {
- href: 'https://github.com/MetaMask/faq/blob/master/COINBASE.md',
- onClick: (event) => this.navigateTo('https://info.shapeshift.io/about'),
- }, [
- h('i.fa.fa-question-circle', {
- style: {
- margin: '0px 5px',
- },
- }),
- ]),
- ],
- key: 'shapeshift',
+ }, 'Buy Eth'),
+ ]),
+ h('div', {
+ style: {
+ position: 'absolute',
+ top: '57vh',
+ left: '49vw',
+ },
+ }, [
+ h(Loading, {isLoading}),
+ ]),
+ h('div', {
+ style: {
+ width: '80%',
+ },
+ }, [
+ h(AccountPanel, {
+ showFullAddress: true,
+ identity: props.identity,
+ account: props.account,
+ }),
+ ]),
+ h('h3.text-transform-uppercase', {
+ style: {
+ paddingLeft: '15px',
+ fontFamily: 'Montserrat Light',
+ width: '100vw',
+ background: 'rgb(235, 235, 235)',
+ color: 'rgb(174, 174, 174)',
+ paddingTop: '4px',
+ paddingBottom: '4px',
+ },
+ }, 'Select Service'),
+ h('.flex-row.selected-exchange', {
+ style: {
+ position: 'relative',
+ right: '35px',
+ marginTop: '20px',
+ marginBottom: '20px',
+ },
+ }, [
+ h(RadioList, {
+ defaultFocus: props.buyView.subview,
+ labels: [
+ 'Coinbase',
+ 'ShapeShift',
+ ],
+ subtext: {
+ 'Coinbase': 'Crypto/FIAT (USA only)',
+ 'ShapeShift': 'Crypto',
},
- ],
- defaultTab: 'coinbase',
- tabSelected: (key) => {
- switch (key) {
- case 'coinbase':
- props.dispatch(actions.coinBaseSubview())
- break
- case 'shapeshift':
- props.dispatch(actions.shapeShiftSubview(props.provider.type))
- break
- }
+ onClick: this.radioHandler.bind(this),
+ }),
+ ]),
+ h('h3.text-transform-uppercase', {
+ style: {
+ paddingLeft: '15px',
+ fontFamily: 'Montserrat Light',
+ width: '100vw',
+ background: 'rgb(235, 235, 235)',
+ color: 'rgb(174, 174, 174)',
+ paddingTop: '4px',
+ paddingBottom: '4px',
},
- }),
-
+ }, props.buyView.subview),
this.formVersionSubview(),
])
)
@@ -124,13 +152,19 @@ BuyButtonSubview.prototype.formVersionSubview = function () {
marginBottom: '15px',
},
}, 'In order to access this feature, please switch to the Main Network'),
- ((network === '3') || (network === '42')) ? h('h3.text-transform-uppercase', 'or go to the') : null,
+ ((network === '3') || (network === '4') || (network === '42')) ? h('h3.text-transform-uppercase', 'or go to the') : null,
(network === '3') ? h('button.text-transform-uppercase', {
onClick: () => this.props.dispatch(actions.buyEth({ network })),
style: {
marginTop: '15px',
},
}, 'Ropsten Test Faucet') : null,
+ (network === '4') ? h('button.text-transform-uppercase', {
+ onClick: () => this.props.dispatch(actions.buyEth({ network })),
+ style: {
+ marginTop: '15px',
+ },
+ }, 'Rinkeby Test Faucet') : null,
(network === '42') ? h('button.text-transform-uppercase', {
onClick: () => this.props.dispatch(actions.buyEth({ network })),
style: {
@@ -152,3 +186,12 @@ BuyButtonSubview.prototype.backButtonContext = function () {
this.props.dispatch(actions.goHome())
}
}
+
+BuyButtonSubview.prototype.radioHandler = function (event) {
+ switch (event.target.title) {
+ case 'Coinbase':
+ return this.props.dispatch(actions.coinBaseSubview())
+ case 'ShapeShift':
+ return this.props.dispatch(actions.shapeShiftSubview(this.props.provider.type))
+ }
+}
diff --git a/ui/app/components/coinbase-form.js b/ui/app/components/coinbase-form.js
index fd5816a21..f44d86045 100644
--- a/ui/app/components/coinbase-form.js
+++ b/ui/app/components/coinbase-form.js
@@ -4,7 +4,6 @@ const inherits = require('util').inherits
const connect = require('react-redux').connect
const actions = require('../actions')
-const isValidAddress = require('../util').isValidAddress
module.exports = connect(mapStateToProps)(CoinbaseForm)
function mapStateToProps (state) {
@@ -21,105 +20,36 @@ function CoinbaseForm () {
CoinbaseForm.prototype.render = function () {
var props = this.props
- var amount = props.buyView.amount
- var address = props.buyView.buyAddress
return h('.flex-column', {
style: {
- // margin: '10px',
+ marginTop: '35px',
padding: '25px',
+ width: '100%',
},
}, [
- h('.flex-column', {
- style: {
- alignItems: 'flex-start',
- },
- }, [
- h('.flex-row', [
- h('div', 'Address:'),
- h('.ellip-address', address),
- ]),
- h('.flex-row', [
- h('div', 'Amount: $'),
- h('.input-container', [
- h('input.buy-inputs', {
- style: {
- width: '3em',
- boxSizing: 'border-box',
- },
- defaultValue: amount,
- onChange: this.handleAmount.bind(this),
- }),
- h('i.fa.fa-pencil-square-o.edit-text', {
- style: {
- fontSize: '12px',
- color: '#F7861C',
- position: 'relative',
- bottom: '5px',
- right: '11px',
- },
- }),
- ]),
- ]),
- ]),
-
- h('.info-gray', {
- style: {
- fontSize: '10px',
- fontFamily: 'Montserrat Light',
- margin: '15px',
- lineHeight: '13px',
- },
- },
- `there is a USD$ 15 a day max and a USD$ 50
- dollar limit per the life time of an account without a
- coinbase account. A fee of 3.75% will be aplied to debit/credit cards.`),
-
- !props.warning ? h('div', {
- style: {
- width: '340px',
- height: '22px',
- },
- }) : props.warning && h('span.error.flex-center', props.warning),
-
-
h('.flex-row', {
style: {
justifyContent: 'space-around',
margin: '33px',
+ marginTop: '0px',
},
}, [
- h('button', {
+ h('button.btn-green', {
onClick: this.toCoinbase.bind(this),
}, 'Continue to Coinbase'),
- h('button', {
+ h('button.btn-red', {
onClick: () => props.dispatch(actions.backTobuyView(props.accounts.address)),
}, 'Cancel'),
]),
])
}
-CoinbaseForm.prototype.handleAmount = function (event) {
- this.props.dispatch(actions.updateCoinBaseAmount(event.target.value))
-}
-CoinbaseForm.prototype.handleAddress = function (event) {
- this.props.dispatch(actions.updateBuyAddress(event.target.value))
-}
-CoinbaseForm.prototype.toCoinbase = function () {
- var props = this.props
- var amount = props.buyView.amount
- var address = props.buyView.buyAddress
- var message
- if (isValidAddress(address) && isValidAmountforCoinBase(amount).valid) {
- props.dispatch(actions.buyEth({ network: '1', address, amount: props.buyView.amount }))
- } else if (!isValidAmountforCoinBase(amount).valid) {
- message = isValidAmountforCoinBase(amount).message
- return props.dispatch(actions.displayWarning(message))
- } else {
- message = 'Receiving address is invalid.'
- return props.dispatch(actions.displayWarning(message))
- }
+CoinbaseForm.prototype.toCoinbase = function () {
+ const props = this.props
+ const address = props.buyView.buyAddress
+ props.dispatch(actions.buyEth({ network: '1', address, amount: 0 }))
}
CoinbaseForm.prototype.renderLoading = function () {
@@ -131,29 +61,3 @@ CoinbaseForm.prototype.renderLoading = function () {
src: 'images/loading.svg',
})
}
-
-function isValidAmountforCoinBase (amount) {
- amount = parseFloat(amount)
- if (amount) {
- if (amount <= 15 && amount > 0) {
- return {
- valid: true,
- }
- } else if (amount > 15) {
- return {
- valid: false,
- message: 'The amount can not be greater then $15',
- }
- } else {
- return {
- valid: false,
- message: 'Can not buy amounts less then $0',
- }
- }
- } else {
- return {
- valid: false,
- message: 'The amount entered is not a number',
- }
- }
-}
diff --git a/ui/app/components/copyable.js b/ui/app/components/copyable.js
new file mode 100644
index 000000000..a4f6f4bc6
--- /dev/null
+++ b/ui/app/components/copyable.js
@@ -0,0 +1,46 @@
+const Component = require('react').Component
+const h = require('react-hyperscript')
+const inherits = require('util').inherits
+
+const Tooltip = require('./tooltip')
+const copyToClipboard = require('copy-to-clipboard')
+
+module.exports = Copyable
+
+inherits(Copyable, Component)
+function Copyable () {
+ Component.call(this)
+ this.state = {
+ copied: false,
+ }
+}
+
+Copyable.prototype.render = function () {
+ const props = this.props
+ const state = this.state
+ const { value, children } = props
+ const { copied } = state
+
+ return h(Tooltip, {
+ title: copied ? 'Copied!' : 'Copy',
+ position: 'bottom',
+ }, h('span', {
+ style: {
+ cursor: 'pointer',
+ },
+ onClick: (event) => {
+ event.preventDefault()
+ event.stopPropagation()
+ copyToClipboard(value)
+ this.debounceRestore()
+ },
+ }, children))
+}
+
+Copyable.prototype.debounceRestore = function () {
+ this.setState({ copied: true })
+ clearTimeout(this.timeout)
+ this.timeout = setTimeout(() => {
+ this.setState({ copied: false })
+ }, 850)
+}
diff --git a/ui/app/components/custom-radio-list.js b/ui/app/components/custom-radio-list.js
new file mode 100644
index 000000000..a4c525396
--- /dev/null
+++ b/ui/app/components/custom-radio-list.js
@@ -0,0 +1,60 @@
+const Component = require('react').Component
+const h = require('react-hyperscript')
+const inherits = require('util').inherits
+
+module.exports = RadioList
+
+inherits(RadioList, Component)
+function RadioList () {
+ Component.call(this)
+}
+
+RadioList.prototype.render = function () {
+ const props = this.props
+ const activeClass = '.custom-radio-selected'
+ const inactiveClass = '.custom-radio-inactive'
+ const {
+ labels,
+ defaultFocus,
+ } = props
+
+
+ return (
+ h('.flex-row', {
+ style: {
+ fontSize: '12px',
+ },
+ }, [
+ h('.flex-column.custom-radios', {
+ style: {
+ marginRight: '5px',
+ },
+ },
+ labels.map((lable, i) => {
+ let isSelcted = (this.state !== null)
+ isSelcted = isSelcted ? (this.state.selected === lable) : (defaultFocus === lable)
+ return h(isSelcted ? activeClass : inactiveClass, {
+ title: lable,
+ onClick: (event) => {
+ this.setState({selected: event.target.title})
+ props.onClick(event)
+ },
+ })
+ })
+ ),
+ h('.text', {},
+ labels.map((lable) => {
+ if (props.subtext) {
+ return h('.flex-row', {}, [
+ h('.radio-titles', lable),
+ h('.radio-titles-subtext', `- ${props.subtext[lable]}`),
+ ])
+ } else {
+ return h('.radio-titles', lable)
+ }
+ })
+ ),
+ ])
+ )
+}
+
diff --git a/ui/app/components/drop-menu-item.js b/ui/app/components/drop-menu-item.js
index 3eb6ec876..e42948209 100644
--- a/ui/app/components/drop-menu-item.js
+++ b/ui/app/components/drop-menu-item.js
@@ -42,11 +42,14 @@ DropMenuItem.prototype.activeNetworkRender = function () {
if (providerType === 'mainnet') return h('.check', '✓')
break
case 'Ropsten Test Network':
- if (providerType === 'testnet') return h('.check', '✓')
+ if (providerType === 'ropsten') return h('.check', '✓')
break
case 'Kovan Test Network':
if (providerType === 'kovan') return h('.check', '✓')
break
+ case 'Rinkeby Test Network':
+ if (providerType === 'rinkeby') return h('.check', '✓')
+ break
case 'Localhost 8545':
if (activeNetwork === 'http://localhost:8545') return h('.check', '✓')
break
diff --git a/ui/app/components/ens-input.js b/ui/app/components/ens-input.js
index facf29d97..43bb7ab22 100644
--- a/ui/app/components/ens-input.js
+++ b/ui/app/components/ens-input.js
@@ -5,11 +5,9 @@ const extend = require('xtend')
const debounce = require('debounce')
const copyToClipboard = require('copy-to-clipboard')
const ENS = require('ethjs-ens')
+const networkMap = require('ethjs-ens/lib/network-map.json')
const ensRE = /.+\.eth$/
-const networkResolvers = {
- '3': '112234455c3a32fd11230c42e7bccd4a84e02010',
-}
module.exports = EnsInput
@@ -23,9 +21,10 @@ EnsInput.prototype.render = function () {
const opts = extend(props, {
list: 'addresses',
onChange: () => {
+ this.setState({ ensResolution: '0x0000000000000000000000000000000000000000' })
const network = this.props.network
- let resolverAddress = networkResolvers[network]
- if (!resolverAddress) return
+ const networkHasEnsSupport = getNetworkEnsSupport(network)
+ if (!networkHasEnsSupport) return
const recipient = document.querySelector('input[name="address"]').value
if (recipient.match(ensRE) === null) {
@@ -52,7 +51,7 @@ EnsInput.prototype.render = function () {
[
// Corresponds to the addresses owned.
Object.keys(props.identities).map((key) => {
- let identity = props.identities[key]
+ const identity = props.identities[key]
return h('option', {
value: identity.address,
label: identity.name,
@@ -63,6 +62,7 @@ EnsInput.prototype.render = function () {
return h('option', {
value: identity.address,
label: identity.name,
+ key: identity.address,
})
}),
]),
@@ -72,10 +72,10 @@ EnsInput.prototype.render = function () {
EnsInput.prototype.componentDidMount = function () {
const network = this.props.network
- let resolverAddress = networkResolvers[network]
+ const networkHasEnsSupport = getNetworkEnsSupport(network)
- if (resolverAddress) {
- const provider = web3.currentProvider
+ if (networkHasEnsSupport) {
+ const provider = global.ethereumProvider
this.ens = new ENS({ provider, network })
this.checkName = debounce(this.lookupEnsName.bind(this), 200)
}
@@ -96,12 +96,14 @@ EnsInput.prototype.lookupEnsName = function () {
log.info(`ENS attempting to resolve name: ${recipient}`)
this.ens.lookup(recipient.trim())
.then((address) => {
+ if (address === '0x0000000000000000000000000000000000000000') throw new Error('No address has been set for this name.')
if (address !== ensResolution) {
this.setState({
loadingEns: false,
ensResolution: address,
nickname: recipient.trim(),
hoverText: address + '\nClick to Copy',
+ ensFailure: false,
})
}
})
@@ -109,6 +111,7 @@ EnsInput.prototype.lookupEnsName = function () {
log.error(reason)
return this.setState({
loadingEns: false,
+ ensResolution: '0x0000000000000000000000000000000000000000',
ensFailure: true,
hoverText: reason.message,
})
@@ -168,3 +171,8 @@ EnsInput.prototype.ensIconContents = function (recipient) {
})
}
}
+
+function getNetworkEnsSupport (network) {
+ return Boolean(networkMap[network])
+}
+
diff --git a/ui/app/components/eth-balance.js b/ui/app/components/eth-balance.js
index 57ca84564..4f538fd31 100644
--- a/ui/app/components/eth-balance.js
+++ b/ui/app/components/eth-balance.js
@@ -16,20 +16,19 @@ function EthBalanceComponent () {
EthBalanceComponent.prototype.render = function () {
var props = this.props
let { value } = props
- var style = props.style
+ const { style, width } = props
var needsParse = this.props.needsParse !== undefined ? this.props.needsParse : true
value = value ? formatBalance(value, 6, needsParse) : '...'
- var width = props.width
return (
h('.ether-balance.ether-balance-amount', {
- style: style,
+ style,
}, [
h('div', {
style: {
display: 'inline',
- width: width,
+ width,
},
}, this.renderBalance(value)),
])
@@ -38,16 +37,17 @@ EthBalanceComponent.prototype.render = function () {
}
EthBalanceComponent.prototype.renderBalance = function (value) {
var props = this.props
+ const { conversionRate, shorten, incoming, currentCurrency } = props
if (value === 'None') return value
if (value === '...') return value
- var balanceObj = generateBalanceObject(value, props.shorten ? 1 : 3)
+ var balanceObj = generateBalanceObject(value, shorten ? 1 : 3)
var balance
var splitBalance = value.split(' ')
var ethNumber = splitBalance[0]
var ethSuffix = splitBalance[1]
const showFiat = 'showFiat' in props ? props.showFiat : true
- if (props.shorten) {
+ if (shorten) {
balance = balanceObj.shortBalance
} else {
balance = balanceObj.balance
@@ -73,7 +73,7 @@ EthBalanceComponent.prototype.renderBalance = function (value) {
width: '100%',
textAlign: 'right',
},
- }, this.props.incoming ? `+${balance}` : balance),
+ }, incoming ? `+${balance}` : balance),
h('div', {
style: {
color: ' #AEAEAE',
@@ -83,7 +83,7 @@ EthBalanceComponent.prototype.renderBalance = function (value) {
}, label),
]),
- showFiat ? h(FiatValue, { value: props.value }) : null,
+ showFiat ? h(FiatValue, { value: props.value, conversionRate, currentCurrency }) : null,
]))
)
}
diff --git a/ui/app/components/fiat-value.js b/ui/app/components/fiat-value.js
index 298809b30..8a64a1cfc 100644
--- a/ui/app/components/fiat-value.js
+++ b/ui/app/components/fiat-value.js
@@ -1,17 +1,9 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
-const connect = require('react-redux').connect
const formatBalance = require('../util').formatBalance
-module.exports = connect(mapStateToProps)(FiatValue)
-
-function mapStateToProps (state) {
- return {
- conversionRate: state.metamask.conversionRate,
- currentCurrency: state.metamask.currentCurrency,
- }
-}
+module.exports = FiatValue
inherits(FiatValue, Component)
function FiatValue () {
@@ -20,23 +12,23 @@ function FiatValue () {
FiatValue.prototype.render = function () {
const props = this.props
+ const { conversionRate, currentCurrency } = props
+
const value = formatBalance(props.value, 6)
if (value === 'None') return value
var fiatDisplayNumber, fiatTooltipNumber
var splitBalance = value.split(' ')
- if (props.conversionRate !== 0) {
- fiatTooltipNumber = Number(splitBalance[0]) * props.conversionRate
+ if (conversionRate !== 0) {
+ fiatTooltipNumber = Number(splitBalance[0]) * conversionRate
fiatDisplayNumber = fiatTooltipNumber.toFixed(2)
} else {
fiatDisplayNumber = 'N/A'
fiatTooltipNumber = 'Unknown'
}
- var fiatSuffix = props.currentCurrency
-
- return fiatDisplay(fiatDisplayNumber, fiatSuffix)
+ return fiatDisplay(fiatDisplayNumber, currentCurrency)
}
function fiatDisplay (fiatDisplayNumber, fiatSuffix) {
diff --git a/ui/app/components/hex-as-decimal-input.js b/ui/app/components/hex-as-decimal-input.js
index e37aaa8c3..4a71e9585 100644
--- a/ui/app/components/hex-as-decimal-input.js
+++ b/ui/app/components/hex-as-decimal-input.js
@@ -139,7 +139,7 @@ HexAsDecimalInput.prototype.constructWarning = function () {
}
function hexify (decimalString) {
- const hexBN = new BN(decimalString, 10)
+ const hexBN = new BN(parseInt(decimalString), 10)
return '0x' + hexBN.toString('hex')
}
diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js
index 1bb92301e..58bd2bdc4 100644
--- a/ui/app/components/identicon.js
+++ b/ui/app/components/identicon.js
@@ -1,6 +1,7 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
+const isNode = require('detect-node')
const findDOMNode = require('react-dom').findDOMNode
const jazzicon = require('jazzicon')
const iconFactoryGen = require('../../lib/icon-factory')
@@ -34,19 +35,22 @@ IdenticonComponent.prototype.render = function () {
IdenticonComponent.prototype.componentDidMount = function () {
var props = this.props
- const { address, network } = props
+ const { address } = props
if (!address) return
var container = findDOMNode(this)
var diameter = props.diameter || this.defaultDiameter
- var img = iconFactory.iconForAddress(address, diameter, false, network)
- container.appendChild(img)
+
+ if (!isNode) {
+ var img = iconFactory.iconForAddress(address, diameter)
+ container.appendChild(img)
+ }
}
IdenticonComponent.prototype.componentDidUpdate = function () {
var props = this.props
- const { address, network } = props
+ const { address } = props
if (!address) return
@@ -58,6 +62,9 @@ IdenticonComponent.prototype.componentDidUpdate = function () {
}
var diameter = props.diameter || this.defaultDiameter
- var img = iconFactory.iconForAddress(address, diameter, false, network)
- container.appendChild(img)
+ if (!isNode) {
+ var img = iconFactory.iconForAddress(address, diameter)
+ container.appendChild(img)
+ }
}
+
diff --git a/ui/app/components/network.js b/ui/app/components/network.js
index d9045167f..31a8fc17c 100644
--- a/ui/app/components/network.js
+++ b/ui/app/components/network.js
@@ -34,7 +34,7 @@ Network.prototype.render = function () {
} else if (providerName === 'mainnet') {
hoverText = 'Main Ethereum Network'
iconName = 'ethereum-network'
- } else if (providerName === 'testnet') {
+ } else if (providerName === 'ropsten') {
hoverText = 'Ropsten Test Network'
iconName = 'ropsten-test-network'
} else if (parseInt(networkNumber) === 3) {
@@ -43,6 +43,9 @@ Network.prototype.render = function () {
} else if (providerName === 'kovan') {
hoverText = 'Kovan Test Network'
iconName = 'kovan-test-network'
+ } else if (providerName === 'rinkeby') {
+ hoverText = 'Rinkeby Test Network'
+ iconName = 'rinkeby-test-network'
} else {
hoverText = 'Unknown Private Network'
iconName = 'unknown-private-network'
@@ -82,6 +85,15 @@ Network.prototype.render = function () {
}},
'Kovan Test Net'),
])
+ case 'rinkeby-test-network':
+ return h('.network-indicator', [
+ h('.menu-icon.golden-square'),
+ h('.network-name', {
+ style: {
+ color: '#e7a218',
+ }},
+ 'Rinkeby Test Net'),
+ ])
default:
return h('.network-indicator', [
h('i.fa.fa-question-circle.fa-lg', {
diff --git a/ui/app/components/notice.js b/ui/app/components/notice.js
index b85787033..d9f0067cd 100644
--- a/ui/app/components/notice.js
+++ b/ui/app/components/notice.js
@@ -107,7 +107,7 @@ Notice.prototype.render = function () {
style: {
marginTop: '18px',
},
- }, 'Continue'),
+ }, 'Accept'),
])
)
}
@@ -115,8 +115,9 @@ Notice.prototype.render = function () {
Notice.prototype.componentDidMount = function () {
var node = findDOMNode(this)
linker.setupListener(node)
- if (document.getElementsByClassName('notice-box')[0].clientHeight < 310) { this.setState({disclaimerDisabled: false}) }
-
+ if (document.getElementsByClassName('notice-box')[0].clientHeight < 310) {
+ this.setState({disclaimerDisabled: false})
+ }
}
Notice.prototype.componentWillUnmount = function () {
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js
index 1b83f5043..4b1a00eca 100644
--- a/ui/app/components/pending-tx.js
+++ b/ui/app/components/pending-tx.js
@@ -1,29 +1,26 @@
const Component = require('react').Component
-const connect = require('react-redux').connect
const h = require('react-hyperscript')
const inherits = require('util').inherits
const actions = require('../actions')
+const clone = require('clone')
const ethUtil = require('ethereumjs-util')
const BN = ethUtil.BN
const hexToBn = require('../../../app/scripts/lib/hex-to-bn')
-
+const util = require('../util')
const MiniAccountPanel = require('./mini-account-panel')
+const Copyable = require('./copyable')
const EthBalance = require('./eth-balance')
-const util = require('../util')
const addressSummary = util.addressSummary
const nameForAddress = require('../../lib/contract-namer')
-const HexInput = require('./hex-as-decimal-input')
+const BNInput = require('./bn-as-decimal-input')
-const MIN_GAS_PRICE_BN = new BN(20000000)
+const MIN_GAS_PRICE_GWEI_BN = new BN(2)
+const GWEI_FACTOR = new BN(1e9)
+const MIN_GAS_PRICE_BN = MIN_GAS_PRICE_GWEI_BN.mul(GWEI_FACTOR)
const MIN_GAS_LIMIT_BN = new BN(21000)
-module.exports = connect(mapStateToProps)(PendingTx)
-
-function mapStateToProps (state) {
- return {}
-}
-
+module.exports = PendingTx
inherits(PendingTx, Component)
function PendingTx () {
Component.call(this)
@@ -35,19 +32,29 @@ function PendingTx () {
PendingTx.prototype.render = function () {
const props = this.props
+ const { currentCurrency, blockGasLimit } = props
+ const conversionRate = props.conversionRate
const txMeta = this.gatherTxMeta()
const txParams = txMeta.txParams || {}
+ // Account Details
const address = txParams.from || props.selectedAddress
const identity = props.identities[address] || { address: address }
const account = props.accounts[address]
const balance = account ? account.balance : '0x0'
- const gas = txParams.gas
- const gasPrice = txParams.gasPrice
+ // recipient check
+ const isValidAddress = !txParams.to || util.isValidAddress(txParams.to)
+ // Gas
+ const gas = txParams.gas
const gasBn = hexToBn(gas)
+ const gasLimit = new BN(parseInt(blockGasLimit))
+ const safeGasLimit = this.bnMultiplyByFraction(gasLimit, 19, 20).toString(10)
+
+ // Gas Price
+ const gasPrice = txParams.gasPrice || MIN_GAS_PRICE_BN.toString(16)
const gasPriceBn = hexToBn(gasPrice)
const txFeeBn = gasBn.mul(gasPriceBn)
@@ -55,7 +62,6 @@ PendingTx.prototype.render = function () {
const maxCost = txFeeBn.add(valueBn)
const dataLength = txParams.data ? (txParams.data.length - 2) / 2 : 0
- const imageify = props.imageifyIdenticons === undefined ? true : props.imageifyIdenticons
const balanceBn = hexToBn(balance)
const insufficientBalance = balanceBn.lt(maxCost)
@@ -69,17 +75,8 @@ PendingTx.prototype.render = function () {
}, [
h('form#pending-tx-form', {
- onSubmit: (event) => {
- event.preventDefault()
- const form = document.querySelector('form#pending-tx-form')
- const valid = form.checkValidity()
- this.setState({ valid })
- if (valid && this.verifyGasParams()) {
- props.sendTransaction(txMeta, event)
- } else {
- this.props.dispatch(actions.displayWarning('Invalid Gas Parameters'))
- }
- },
+ onSubmit: this.onSubmit.bind(this),
+
}, [
// tx info
@@ -93,7 +90,6 @@ PendingTx.prototype.render = function () {
h(MiniAccountPanel, {
imageSeed: address,
- imageifyIdenticons: imageify,
picOrder: 'right',
}, [
h('span.font-small', {
@@ -101,11 +97,16 @@ PendingTx.prototype.render = function () {
fontFamily: 'Montserrat Bold, Montserrat, sans-serif',
},
}, identity.name),
- h('span.font-small', {
- style: {
- fontFamily: 'Montserrat Light, Montserrat, sans-serif',
- },
- }, addressSummary(address, 6, 4, false)),
+
+ h(Copyable, {
+ value: ethUtil.toChecksumAddress(address),
+ }, [
+ h('span.font-small', {
+ style: {
+ fontFamily: 'Montserrat Light, Montserrat, sans-serif',
+ },
+ }, addressSummary(address, 6, 4, false)),
+ ]),
h('span.font-small', {
style: {
@@ -114,6 +115,8 @@ PendingTx.prototype.render = function () {
}, [
h(EthBalance, {
value: balance,
+ conversionRate,
+ currentCurrency,
inline: true,
labelColor: '#F7861C',
}),
@@ -151,7 +154,7 @@ PendingTx.prototype.render = function () {
// in the way that gas and gasLimit currently are.
h('.row', [
h('.cell.label', 'Amount'),
- h(EthBalance, { value: txParams.value }),
+ h(EthBalance, { value: txParams.value, currentCurrency, conversionRate }),
]),
// Gas Limit (customizable)
@@ -159,22 +162,21 @@ PendingTx.prototype.render = function () {
h('.cell.label', 'Gas Limit'),
h('.cell.value', {
}, [
- h(HexInput, {
+ h(BNInput, {
name: 'Gas Limit',
- value: gas,
+ value: gasBn,
+ precision: 0,
+ scale: 0,
// The hard lower limit for gas.
min: MIN_GAS_LIMIT_BN.toString(10),
+ max: safeGasLimit,
suffix: 'UNITS',
style: {
position: 'relative',
top: '5px',
},
- onChange: (newHex) => {
- log.info(`Gas limit changed to ${newHex}`)
- const txMeta = this.gatherTxMeta()
- txMeta.txParams.gas = newHex
- this.setState({ txData: txMeta })
- },
+ onChange: this.gasLimitChanged.bind(this),
+
ref: (hexInput) => { this.inputs.push(hexInput) },
}),
]),
@@ -185,21 +187,18 @@ PendingTx.prototype.render = function () {
h('.cell.label', 'Gas Price'),
h('.cell.value', {
}, [
- h(HexInput, {
+ h(BNInput, {
name: 'Gas Price',
- value: gasPrice,
- suffix: 'WEI',
- min: MIN_GAS_PRICE_BN.toString(10),
+ value: gasPriceBn,
+ precision: 9,
+ scale: 9,
+ suffix: 'GWEI',
+ min: MIN_GAS_PRICE_GWEI_BN.toString(10),
style: {
position: 'relative',
top: '5px',
},
- onChange: (newHex) => {
- log.info(`Gas price changed to: ${newHex}`)
- const txMeta = this.gatherTxMeta()
- txMeta.txParams.gasPrice = newHex
- this.setState({ txData: txMeta })
- },
+ onChange: this.gasPriceChanged.bind(this),
ref: (hexInput) => { this.inputs.push(hexInput) },
}),
]),
@@ -208,7 +207,7 @@ PendingTx.prototype.render = function () {
// Max Transaction Fee (calculated)
h('.cell.row', [
h('.cell.label', 'Max Transaction Fee'),
- h(EthBalance, { value: txFeeBn.toString(16) }),
+ h(EthBalance, { value: txFeeBn.toString(16), currentCurrency, conversionRate }),
]),
h('.cell.row', {
@@ -227,6 +226,8 @@ PendingTx.prototype.render = function () {
}, [
h(EthBalance, {
value: maxCost.toString(16),
+ currentCurrency,
+ conversionRate,
inline: true,
labelColor: 'black',
fontSize: '16px',
@@ -269,6 +270,15 @@ PendingTx.prototype.render = function () {
}, 'Transaction Error. Exception thrown in contract code.')
: null,
+ !isValidAddress ?
+ h('.error', {
+ style: {
+ marginLeft: 50,
+ fontSize: '0.9em',
+ },
+ }, 'Recipient address is invalid. Sending this transaction will result in a loss of ETH.')
+ : null,
+
insufficientBalance ?
h('span.error', {
style: {
@@ -289,7 +299,7 @@ PendingTx.prototype.render = function () {
insufficientBalance ?
- h('button', {
+ h('button.btn-green', {
onClick: props.buyEth,
}, 'Buy Ether')
: null,
@@ -306,7 +316,7 @@ PendingTx.prototype.render = function () {
type: 'submit',
value: 'ACCEPT',
style: { marginLeft: '10px' },
- disabled: insufficientBalance || !this.state.valid,
+ disabled: insufficientBalance || !this.state.valid || !isValidAddress,
}),
h('button.cancel.btn-red', {
@@ -323,29 +333,33 @@ PendingTx.prototype.miniAccountPanelForRecipient = function () {
const txData = props.txData
const txParams = txData.txParams || {}
const isContractDeploy = !('to' in txParams)
- const imageify = props.imageifyIdenticons === undefined ? true : props.imageifyIdenticons
// If it's not a contract deploy, send to the account
if (!isContractDeploy) {
return h(MiniAccountPanel, {
imageSeed: txParams.to,
- imageifyIdenticons: imageify,
picOrder: 'left',
}, [
+
h('span.font-small', {
style: {
fontFamily: 'Montserrat Bold, Montserrat, sans-serif',
},
}, nameForAddress(txParams.to, props.identities)),
- h('span.font-small', {
- style: {
- fontFamily: 'Montserrat Light, Montserrat, sans-serif',
- },
- }, addressSummary(txParams.to, 6, 4, false)),
+
+ h(Copyable, {
+ value: ethUtil.toChecksumAddress(txParams.to),
+ }, [
+ h('span.font-small', {
+ style: {
+ fontFamily: 'Montserrat Light, Montserrat, sans-serif',
+ },
+ }, addressSummary(txParams.to, 6, 4, false)),
+ ]),
+
])
} else {
return h(MiniAccountPanel, {
- imageifyIdenticons: imageify,
picOrder: 'left',
}, [
@@ -359,6 +373,26 @@ PendingTx.prototype.miniAccountPanelForRecipient = function () {
}
}
+PendingTx.prototype.gasPriceChanged = function (newBN, valid) {
+ log.info(`Gas price changed to: ${newBN.toString(10)}`)
+ const txMeta = this.gatherTxMeta()
+ txMeta.txParams.gasPrice = '0x' + newBN.toString('hex')
+ this.setState({
+ txData: clone(txMeta),
+ valid,
+ })
+}
+
+PendingTx.prototype.gasLimitChanged = function (newBN, valid) {
+ log.info(`Gas limit changed to ${newBN.toString(10)}`)
+ const txMeta = this.gatherTxMeta()
+ txMeta.txParams.gas = '0x' + newBN.toString('hex')
+ this.setState({
+ txData: clone(txMeta),
+ valid,
+ })
+}
+
PendingTx.prototype.resetGasFields = function () {
log.debug(`pending-tx resetGasFields`)
@@ -374,12 +408,39 @@ PendingTx.prototype.resetGasFields = function () {
})
}
+PendingTx.prototype.onSubmit = function (event) {
+ event.preventDefault()
+ const txMeta = this.gatherTxMeta()
+ const valid = this.checkValidity()
+ this.setState({ valid })
+ if (valid && this.verifyGasParams()) {
+ this.props.sendTransaction(txMeta, event)
+ } else {
+ this.props.dispatch(actions.displayWarning('Invalid Gas Parameters'))
+ }
+}
+
+PendingTx.prototype.checkValidity = function () {
+ const form = this.getFormEl()
+ const valid = form.checkValidity()
+ return valid
+}
+
+PendingTx.prototype.getFormEl = function () {
+ const form = document.querySelector('form#pending-tx-form')
+ // Stub out form for unit tests:
+ if (!form) {
+ return { checkValidity () { return true } }
+ }
+ return form
+}
+
// After a customizable state value has been updated,
PendingTx.prototype.gatherTxMeta = function () {
log.debug(`pending-tx gatherTxMeta`)
const props = this.props
const state = this.state
- const txData = state.txData || props.txData
+ const txData = clone(state.txData) || clone(props.txData)
log.debug(`UI has defaulted to tx meta ${JSON.stringify(txData)}`)
return txData
@@ -398,9 +459,14 @@ PendingTx.prototype._notZeroOrEmptyString = function (obj) {
return obj !== '' && obj !== '0x0'
}
+PendingTx.prototype.bnMultiplyByFraction = function (targetBN, numerator, denominator) {
+ const numBN = new BN(numerator)
+ const denomBN = new BN(denominator)
+ return targetBN.mul(numBN).div(denomBN)
+}
+
function forwardCarrat () {
return (
-
h('img', {
src: 'images/forward-carrat.svg',
style: {
@@ -408,7 +474,5 @@ function forwardCarrat () {
height: '37px',
},
})
-
)
}
-
diff --git a/ui/app/components/qr-code.js b/ui/app/components/qr-code.js
index 5488599eb..06b9aed9b 100644
--- a/ui/app/components/qr-code.js
+++ b/ui/app/components/qr-code.js
@@ -3,6 +3,7 @@ const h = require('react-hyperscript')
const qrCode = require('qrcode-npm').qrcode
const inherits = require('util').inherits
const connect = require('react-redux').connect
+const isHexPrefixed = require('ethereumjs-util').isHexPrefixed
const CopyButton = require('./copyButton')
module.exports = connect(mapStateToProps)(QrCodeView)
@@ -22,13 +23,12 @@ function QrCodeView () {
}
QrCodeView.prototype.render = function () {
- var props = this.props
- var Qr = props.Qr
- var qrImage = qrCode(4, 'M')
-
- qrImage.addData(Qr.data)
+ const props = this.props
+ const Qr = props.Qr
+ const address = `${isHexPrefixed(Qr.data) ? 'ethereum:' : ''}${Qr.data}`
+ const qrImage = qrCode(4, 'M')
+ qrImage.addData(address)
qrImage.make()
-
return h('.main-container.flex-column', {
key: 'qr',
style: {
diff --git a/ui/app/components/shapeshift-form.js b/ui/app/components/shapeshift-form.js
index 8c9686035..e0a720426 100644
--- a/ui/app/components/shapeshift-form.js
+++ b/ui/app/components/shapeshift-form.js
@@ -43,14 +43,18 @@ ShapeshiftForm.prototype.renderMain = function () {
style: {
// marginTop: '10px',
padding: '25px',
+ paddingTop: '5px',
width: '100%',
+ minHeight: '215px',
alignItems: 'center',
+ overflowY: 'auto',
},
}, [
h('.flex-row', {
style: {
justifyContent: 'center',
alignItems: 'baseline',
+ height: '42px',
},
}, [
h('img', {
@@ -66,6 +70,7 @@ ShapeshiftForm.prototype.renderMain = function () {
h('input#fromCoin.buy-inputs.ex-coins', {
type: 'text',
list: 'coinList',
+ autoFocus: true,
dataset: {
persistentFormId: 'input-coin',
},
@@ -92,7 +97,6 @@ ShapeshiftForm.prototype.renderMain = function () {
h('.icon-control', [
h('i.fa.fa-refresh.fa-4.orange', {
style: {
- position: 'relative',
bottom: '5px',
left: '5px',
color: '#F7861C',
@@ -121,8 +125,6 @@ ShapeshiftForm.prototype.renderMain = function () {
},
}),
]),
-
- this.props.isSubLoading ? this.renderLoading() : null,
h('.flex-column', {
style: {
alignItems: 'flex-start',
@@ -138,17 +140,6 @@ ShapeshiftForm.prototype.renderMain = function () {
this.props.warning) : this.renderInfo(),
]),
- h('.flex-row', {
- style: {
- padding: '10px',
- paddingBottom: '2px',
- width: '100%',
- },
- }, [
- h('div', 'Receiving address:'),
- h('.ellip-address', this.props.buyView.buyAddress),
- ]),
-
h(this.activeToggle('.input-container'), {
style: {
padding: '10px',
@@ -156,6 +147,7 @@ ShapeshiftForm.prototype.renderMain = function () {
width: '100%',
},
}, [
+
h('div', `${coin} Address:`),
h('input#fromCoinAddress.buy-inputs', {
@@ -166,8 +158,8 @@ ShapeshiftForm.prototype.renderMain = function () {
},
style: {
boxSizing: 'border-box',
- width: '278px',
- height: '20px',
+ width: '227px',
+ height: '30px',
padding: ' 5px ',
},
}),
@@ -177,7 +169,7 @@ ShapeshiftForm.prototype.renderMain = function () {
fontSize: '12px',
color: '#F7861C',
position: 'relative',
- bottom: '5px',
+ bottom: '10px',
right: '11px',
},
}),
@@ -190,6 +182,8 @@ ShapeshiftForm.prototype.renderMain = function () {
onClick: this.shift.bind(this),
style: {
marginTop: '10px',
+ position: 'relative',
+ bottom: '40px',
},
},
'Submit'),
@@ -266,8 +260,6 @@ ShapeshiftForm.prototype.renderInfo = function () {
return h('span', {
style: {
- marginTop: '10px',
- marginBottom: '15px',
},
}, [
h('h3.flex-row.text-transform-uppercase', {
@@ -286,10 +278,6 @@ ShapeshiftForm.prototype.renderInfo = function () {
])
}
-ShapeshiftForm.prototype.handleAddress = function (event) {
- this.props.dispatch(actions.updateBuyAddress(event.target.value))
-}
-
ShapeshiftForm.prototype.activeToggle = function (elementType) {
if (!this.props.buyView.formView.response || this.props.warning) return elementType
return `${elementType}.inactive`
diff --git a/ui/app/components/shift-list-item.js b/ui/app/components/shift-list-item.js
index 96a7cba6e..32bfbeda4 100644
--- a/ui/app/components/shift-list-item.js
+++ b/ui/app/components/shift-list-item.js
@@ -8,14 +8,17 @@ const actions = require('../actions')
const addressSummary = require('../util').addressSummary
const CopyButton = require('./copyButton')
-const EtherBalance = require('./eth-balance')
+const EthBalance = require('./eth-balance')
const Tooltip = require('./tooltip')
module.exports = connect(mapStateToProps)(ShiftListItem)
function mapStateToProps (state) {
- return {}
+ return {
+ conversionRate: state.metamask.conversionRate,
+ currentCurrency: state.metamask.currentCurrency,
+ }
}
inherits(ShiftListItem, Component)
@@ -64,6 +67,7 @@ function formatDate (date) {
ShiftListItem.prototype.renderUtilComponents = function () {
var props = this.props
+ const { conversionRate, currentCurrency } = props
switch (props.response.status) {
case 'no_deposits':
@@ -94,8 +98,10 @@ ShiftListItem.prototype.renderUtilComponents = function () {
h(CopyButton, {
value: this.props.response.transaction,
}),
- h(EtherBalance, {
+ h(EthBalance, {
value: `${props.response.outgoingCoin}`,
+ conversionRate,
+ currentCurrency,
width: '55px',
shorten: true,
needsParse: false,
diff --git a/ui/app/components/transaction-list-item-icon.js b/ui/app/components/transaction-list-item-icon.js
index ca2781451..431054340 100644
--- a/ui/app/components/transaction-list-item-icon.js
+++ b/ui/app/components/transaction-list-item-icon.js
@@ -1,6 +1,7 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
+const Tooltip = require('./tooltip')
const Identicon = require('./identicon')
@@ -15,7 +16,7 @@ TransactionIcon.prototype.render = function () {
const { transaction, txParams, isMsg } = this.props
switch (transaction.status) {
case 'unapproved':
- return h( !isMsg ? '.unapproved-tx-icon' : 'i.fa.fa-certificate.fa-lg')
+ return h(!isMsg ? '.unapproved-tx-icon' : 'i.fa.fa-certificate.fa-lg')
case 'rejected':
return h('i.fa.fa-exclamation-triangle.fa-lg.warning', {
@@ -32,11 +33,16 @@ TransactionIcon.prototype.render = function () {
})
case 'submitted':
- return h('i.fa.fa-ellipsis-h', {
- style: {
- fontSize: '27px',
- },
- })
+ return h(Tooltip, {
+ title: 'Pending',
+ position: 'bottom',
+ }, [
+ h('i.fa.fa-ellipsis-h', {
+ style: {
+ fontSize: '27px',
+ },
+ }),
+ ])
}
if (isMsg) {
diff --git a/ui/app/components/transaction-list-item.js b/ui/app/components/transaction-list-item.js
index 9fef52355..dbda66a31 100644
--- a/ui/app/components/transaction-list-item.js
+++ b/ui/app/components/transaction-list-item.js
@@ -2,12 +2,13 @@ const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
-const EtherBalance = require('./eth-balance')
+const EthBalance = require('./eth-balance')
const addressSummary = require('../util').addressSummary
const explorerLink = require('../../lib/explorer-link')
const CopyButton = require('./copyButton')
const vreme = new (require('vreme'))
const Tooltip = require('./tooltip')
+const numberToBN = require('number-to-bn')
const TransactionIcon = require('./transaction-list-item-icon')
const ShiftListItem = require('./shift-list-item')
@@ -19,7 +20,7 @@ function TransactionListItem () {
}
TransactionListItem.prototype.render = function () {
- const { transaction, network } = this.props
+ const { transaction, network, conversionRate, currentCurrency } = this.props
if (transaction.key === 'shapeshift') {
if (network === '1') return h(ShiftListItem, transaction)
}
@@ -27,7 +28,7 @@ TransactionListItem.prototype.render = function () {
let isLinkable = false
const numericNet = parseInt(network)
- isLinkable = numericNet === 1 || numericNet === 3 || numericNet === 42
+ isLinkable = numericNet === 1 || numericNet === 3 || numericNet === 4 || numericNet === 42
var isMsg = ('msgParams' in transaction)
var isTx = ('txParams' in transaction)
@@ -39,6 +40,8 @@ TransactionListItem.prototype.render = function () {
txParams = transaction.msgParams
}
+ const nonce = txParams.nonce ? numberToBN(txParams.nonce).toString(10) : ''
+
const isClickable = ('hash' in transaction && isLinkable) || isPending
return (
h(`.transaction-list-item.flex-row.flex-space-between${isClickable ? '.pointer' : ''}`, {
@@ -69,6 +72,22 @@ TransactionListItem.prototype.render = function () {
]),
]),
+ h(Tooltip, {
+ title: 'Transaction Number',
+ position: 'bottom',
+ }, [
+ h('span', {
+ style: {
+ display: 'flex',
+ cursor: 'normal',
+ flexDirection: 'column',
+ alignItems: 'center',
+ justifyContent: 'center',
+ padding: '10px',
+ },
+ }, nonce),
+ ]),
+
h('.flex-column', {style: {width: '200px', overflow: 'hidden'}}, [
domainField(txParams),
h('div', date),
@@ -78,8 +97,10 @@ TransactionListItem.prototype.render = function () {
// Places a copy button if tx is successful, else places a placeholder empty div.
transaction.hash ? h(CopyButton, { value: transaction.hash }) : h('div', {style: { display: 'flex', alignItems: 'center', width: '26px' }}),
- isTx ? h(EtherBalance, {
+ isTx ? h(EthBalance, {
value: txParams.value,
+ conversionRate,
+ currentCurrency,
width: '55px',
shorten: true,
showFiat: false,
@@ -134,7 +155,6 @@ function failIfFailed (transaction) {
return h('span.error', ' (Rejected)')
}
if (transaction.err) {
-
return h(Tooltip, {
title: transaction.err.message,
position: 'bottom',
@@ -142,5 +162,4 @@ function failIfFailed (transaction) {
h('span.error', ' (Failed)'),
])
}
-
}
diff --git a/ui/app/components/transaction-list.js b/ui/app/components/transaction-list.js
index 4c25f3dd9..3b4ba741e 100644
--- a/ui/app/components/transaction-list.js
+++ b/ui/app/components/transaction-list.js
@@ -13,7 +13,7 @@ function TransactionList () {
}
TransactionList.prototype.render = function () {
- const { transactions, network, unapprovedMsgs } = this.props
+ const { transactions, network, unapprovedMsgs, conversionRate } = this.props
var shapeShiftTxList
if (network === '1') {
@@ -58,6 +58,7 @@ TransactionList.prototype.render = function () {
}
return h(TransactionListItem, {
transaction, i, network, key,
+ conversionRate,
showTx: (txId) => {
this.props.viewPendingTx(txId)
},
diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js
index 3b8618992..747d3ce2b 100644
--- a/ui/app/conf-tx.js
+++ b/ui/app/conf-tx.js
@@ -27,6 +27,9 @@ function mapStateToProps (state) {
warning: state.appState.warning,
network: state.metamask.network,
provider: state.metamask.provider,
+ conversionRate: state.metamask.conversionRate,
+ currentCurrency: state.metamask.currentCurrency,
+ blockGasLimit: state.metamask.currentBlockGasLimit,
}
}
@@ -37,8 +40,8 @@ function ConfirmTxScreen () {
ConfirmTxScreen.prototype.render = function () {
const props = this.props
- const { network, provider, unapprovedTxs,
- unapprovedMsgs, unapprovedPersonalMsgs } = props
+ const { network, provider, unapprovedTxs, currentCurrency,
+ unapprovedMsgs, unapprovedPersonalMsgs, conversionRate, blockGasLimit } = props
var unconfTxList = txHelper(unapprovedTxs, unapprovedMsgs, unapprovedPersonalMsgs, network)
@@ -46,6 +49,7 @@ ConfirmTxScreen.prototype.render = function () {
var txParams = txData.params || {}
var isNotification = isPopupOrNotification() === 'notification'
+
log.info(`rendering a combined ${unconfTxList.length} unconf msg & txs`)
if (unconfTxList.length === 0) return h(Loading, { isLoading: true })
@@ -102,9 +106,12 @@ ConfirmTxScreen.prototype.render = function () {
selectedAddress: props.selectedAddress,
accounts: props.accounts,
identities: props.identities,
+ conversionRate,
+ currentCurrency,
+ blockGasLimit,
// Actions
buyEth: this.buyEth.bind(this, txParams.from || props.selectedAddress),
- sendTransaction: this.sendTransaction.bind(this, txData),
+ sendTransaction: this.sendTransaction.bind(this),
cancelTransaction: this.cancelTransaction.bind(this, txData),
signMessage: this.signMessage.bind(this, txData),
signPersonalMessage: this.signPersonalMessage.bind(this, txData),
@@ -125,14 +132,12 @@ function currentTxView (opts) {
if (txParams) {
log.debug('txParams detected, rendering pending tx')
return h(PendingTx, opts)
-
} else if (msgParams) {
log.debug('msgParams detected, rendering pending msg')
if (type === 'eth_sign') {
log.debug('rendering eth_sign message')
return h(PendingMsg, opts)
-
} else if (type === 'personal_sign') {
log.debug('rendering personal_sign message')
return h(PendingPersonalMsg, opts)
@@ -141,7 +146,7 @@ function currentTxView (opts) {
}
ConfirmTxScreen.prototype.buyEth = function (address, event) {
- this.stopPropagation(event)
+ event.preventDefault()
this.props.dispatch(actions.buyEthView(address))
}
diff --git a/ui/app/config.js b/ui/app/config.js
index 444365de2..d7be26757 100644
--- a/ui/app/config.js
+++ b/ui/app/config.js
@@ -156,7 +156,7 @@ function currentProviderDisplay (metamaskState) {
value = 'Main Ethereum Network'
break
- case 'testnet':
+ case 'ropsten':
title = 'Current Network'
value = 'Ropsten Test Network'
break
@@ -166,6 +166,11 @@ function currentProviderDisplay (metamaskState) {
value = 'Kovan Test Network'
break
+ case 'rinkeby':
+ title = 'Current Network'
+ value = 'Rinkeby Test Network'
+ break
+
default:
title = 'Current RPC'
value = metamaskState.provider.rpcTarget
diff --git a/ui/app/conversion.json b/ui/app/conversion.json
index eeca164ce..155ffc4fc 100644
--- a/ui/app/conversion.json
+++ b/ui/app/conversion.json
@@ -1,5730 +1,207 @@
-{
- "rows":[
- {
- "code":"007",
- "name":"007",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"1337",
- "name":"1337",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"1CR",
- "name":"1CR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"256",
- "name":"256",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"2FLAV",
- "name":"2FLAV",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"2GIVE",
- "name":"2GIVE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"32BIT",
- "name":"32BIT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"404",
- "name":"404",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"611",
- "name":"611",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"888",
- "name":"888",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"8BIT",
- "name":"8Bit",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ACES",
- "name":"ACES",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ACID",
- "name":"ACID",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ACLR",
- "name":"ACLR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ACP",
- "name":"ACP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ADC",
- "name":"ADC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ADZ",
- "name":"Adzcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"AEON",
- "name":"Aeon",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"AGRS",
- "name":"Agoras Tokens",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"AIB",
- "name":"AIB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ALC",
- "name":"ALC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ALTC",
- "name":"ALTC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"AM",
- "name":"AM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"AMBER",
- "name":"AMBER",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"AMS",
- "name":"AMS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ANAL",
- "name":"ANAL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ANI",
- "name":"ANI",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ANC",
- "name":"Anoncoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ANS",
- "name":"ANS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ANTI",
- "name":"AntiBitcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"APEX",
- "name":"APEX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"APC",
- "name":"Applecoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"APT",
- "name":"APT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"AR2",
- "name":"AR2",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ARB",
- "name":"ARB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ARC",
- "name":"ARC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ARCH",
- "name":"ARCH",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ARD",
- "name":"ARD",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ARDR",
- "name":"ARDR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ABY",
- "name":"ArtByte",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ARTC",
- "name":"ARTC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ASAFE",
- "name":"ASAFE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ADCN",
- "name":"Asiadigicoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ASN",
- "name":"ASN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ATEN",
- "name":"ATEN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ATOM",
- "name":"ATOM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ATX",
- "name":"ATX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"REP",
- "name":"Augur",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"AUR",
- "name":"Auroracoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"AUD",
- "name":"Australian Dollar",
- "statuses":[
- "secondary"
- ]
- },
- {
- "code":"AV",
- "name":"AV",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"B2",
- "name":"B2",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"B3",
- "name":"B3",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BA",
- "name":"BA",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BAC",
- "name":"BAC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BASH",
- "name":"BASH",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BTA",
- "name":"Bata",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BAY",
- "name":"BAY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BBCC",
- "name":"BBCC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BQC",
- "name":"BBQCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BEC",
- "name":"BEC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BEEP",
- "name":"BEEP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BELA",
- "name":"BellaCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BERN",
- "name":"BERNcash",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BHC",
- "name":"BHC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BILL",
- "name":"BILL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BILS",
- "name":"BILS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BIOS",
- "name":"BiosCrypto",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BIT",
- "name":"BIT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BIT16",
- "name":"BIT16",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BITB",
- "name":"BitBean",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BTC",
- "name":"Bitcoin",
- "statuses":[
- "primary",
- "secondary"
- ]
- },
- {
- "code":"XBC",
- "name":"Bitcoin Plus",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BTCD",
- "name":"BitcoinDark",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BCY",
- "name":"Bitcrystals",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BFX",
- "name":"Bitfinex Debt token",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BTM",
- "name":"Bitmark",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BITON",
- "name":"BITON",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BTQ",
- "name":"BitQuark",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BITS",
- "name":"BITS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BSD",
- "name":"BitSend",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BTS",
- "name":"BitShares",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SWIFT",
- "name":"BitSwift",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BITZ",
- "name":"Bitz",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BLK",
- "name":"Blackcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BLC",
- "name":"Blakecoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BLEU",
- "name":"BLEU",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BLITZ",
- "name":"Blitzcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BLOCK",
- "name":"Blocknet",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BLRY",
- "name":"BLRY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BLU",
- "name":"BLU",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BLUS",
- "name":"BLUS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BNT",
- "name":"BNT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BOLI",
- "name":"Bolivarcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BBR",
- "name":"Boolberry",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BOOM",
- "name":"BOOM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BOST",
- "name":"BoostCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BOSS",
- "name":"BOSS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BPOK",
- "name":"BPOK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BRAIN",
- "name":"BRAIN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BRC",
- "name":"BRC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BRDD",
- "name":"BRDD",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BRIT",
- "name":"BRIT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GBP",
- "name":"British Pound Sterling",
- "statuses":[
- "secondary"
- ]
- },
- {
- "code":"BRK",
- "name":"BRK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BRX",
- "name":"BRX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BS",
- "name":"BS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BSC",
- "name":"BSC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BST",
- "name":"BST",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BTCHC",
- "name":"BTCHC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BTCR",
- "name":"BTCR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BTCS",
- "name":"BTCS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BTD",
- "name":"BTD",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BTLC",
- "name":"BTLC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BTTF",
- "name":"BTTF",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BTZ",
- "name":"BTZ",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BUCKS",
- "name":"BUCKS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BUN",
- "name":"BUN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BURST",
- "name":"Burst",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BUZZ",
- "name":"BUZZ",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BVC",
- "name":"BVC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BXT",
- "name":"BXT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BYC",
- "name":"Bytecent",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BCN",
- "name":"Bytecoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CAB",
- "name":"Cabbage Unit",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CAGE",
- "name":"CAGE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CAID",
- "name":"CAID",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CAD",
- "name":"Canadian Dollar",
- "statuses":[
- "secondary"
- ]
- },
- {
- "code":"CANN",
- "name":"CannabisCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CCN",
- "name":"Cannacoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CPC",
- "name":"Capricoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CAPT",
- "name":"CAPT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DIEM",
- "name":"CarpeDiemCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CASH",
- "name":"CASH",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CBD",
- "name":"CBD",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CBIT",
- "name":"CBIT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CCX",
- "name":"CCX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CD",
- "name":"CD",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CDN",
- "name":"CDN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CF",
- "name":"CF",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CGA",
- "name":"CGA",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CKC",
- "name":"Checkcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CHEMX",
- "name":"CHEMX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CHESS",
- "name":"CHESS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CHF",
- "name":"CHF",
- "statuses":[
- "primary",
- "secondary"
- ]
- },
- {
- "code":"CNY",
- "name":"Chinese Yuan",
- "statuses":[
- "secondary"
- ]
- },
- {
- "code":"CHOOF",
- "name":"CHOOF",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CJ",
- "name":"CJ",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CLAM",
- "name":"Clams",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CLICK",
- "name":"CLICK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CLINT",
- "name":"CLINT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CLOAK",
- "name":"Cloakcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CLR",
- "name":"CLR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CLUB",
- "name":"CLUB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CLUD",
- "name":"CLUD",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CLV",
- "name":"CLV",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CME",
- "name":"CME",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CMT",
- "name":"CMT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CNC",
- "name":"CNC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"COC",
- "name":"COC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"COXST",
- "name":"CoExistCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"COIN",
- "name":"COIN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"C2",
- "name":"Coin2.1",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CV2",
- "name":"Colossuscoin2.0",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CON",
- "name":"CON",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XCP",
- "name":"Counterparty",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"COVAL",
- "name":"COVAL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"COX",
- "name":"COX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CRAB",
- "name":"CRAB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CRC",
- "name":"CRC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CRE",
- "name":"CRE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CRBIT",
- "name":"Creditbit",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CREVA",
- "name":"CrevaCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CRNK",
- "name":"CRNK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CRPC",
- "name":"CRPC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CRPS",
- "name":"CRPS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CRT",
- "name":"CRT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CRW",
- "name":"CRW",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CRX",
- "name":"CRX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CRY",
- "name":"CRY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CBX",
- "name":"Crypto Bullion",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CESC",
- "name":"CryptoEscudo",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XCN",
- "name":"Cryptonite",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CSH",
- "name":"CSH",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CST",
- "name":"CST",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CTK",
- "name":"CTK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CTL",
- "name":"CTL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CTO",
- "name":"CTO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CURE",
- "name":"Curecoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CYC",
- "name":"CYC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CYP",
- "name":"Cypher",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CZC",
- "name":"CZC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CZR",
- "name":"CZR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DGD",
- "name":"DarkGoldCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DNET",
- "name":"Darknet",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DAS",
- "name":"DAS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DASH",
- "name":"Dash",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DTC",
- "name":"Datacoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DB",
- "name":"DB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DBG",
- "name":"DBG",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DBLK",
- "name":"DBLK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DBTC",
- "name":"DBTC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DC",
- "name":"DC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DCK",
- "name":"DCK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DCRE",
- "name":"DCRE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DCT",
- "name":"DCT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DCYP",
- "name":"DCYP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DCR",
- "name":"Decred",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DES",
- "name":"Destiny",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DEUR",
- "name":"DEUR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DEM",
- "name":"Deutsche eMark",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DVC",
- "name":"Devcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DGMS",
- "name":"DGMS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DGORE",
- "name":"DGORE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DMD",
- "name":"Diamond",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DGB",
- "name":"Digibyte",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"CUBE",
- "name":"DigiCube",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DGC",
- "name":"Digitalcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XDN",
- "name":"DigitalNote",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DP",
- "name":"DigitalPrice",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DIME",
- "name":"Dimecoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DISK",
- "name":"DISK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DKC",
- "name":"DKC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DLC",
- "name":"DLC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DLISK",
- "name":"DLISK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DMC",
- "name":"DMC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NOTE",
- "name":"DNotes",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DOGE",
- "name":"Dogecoin",
- "statuses":[
- "primary",
- "secondary"
- ]
- },
- {
- "code":"DOPE",
- "name":"DopeCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DOV",
- "name":"DOV",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DOX",
- "name":"DOX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DPAY",
- "name":"DPAY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DRACO",
- "name":"DRACO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DRM8",
- "name":"DRM8",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DROP",
- "name":"DROP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DRZ",
- "name":"DRZ",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DSH",
- "name":"DSH",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DTT",
- "name":"DTT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DBIC",
- "name":"DubaiCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DUO",
- "name":"DUO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DUST",
- "name":"DUST",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EAGS",
- "name":"EAGS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EAC",
- "name":"Earthcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EBST",
- "name":"EBST",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EC",
- "name":"EC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ECC",
- "name":"ECCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ECLI",
- "name":"ECLI",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EDC",
- "name":"EDC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EDRC",
- "name":"EDRC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EDR",
- "name":"EDRCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EGG",
- "name":"EGG",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EGO",
- "name":"EGO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EMC2",
- "name":"Einsteinium",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EL",
- "name":"EL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ELE",
- "name":"ELE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EFL",
- "name":"Electronic Gulden",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EMB",
- "name":"EMB",
- "statuses":[
- "secondary"
- ]
- },
- {
- "code":"EME",
- "name":"EME",
- "statuses":[
- "secondary"
- ]
- },
- {
- "code":"EMC",
- "name":"Emercoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EMIRG",
- "name":"EMIRG",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EMP",
- "name":"EMP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EMPC",
- "name":"EMPC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ENRG",
- "name":"Energycoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ENT",
- "name":"ENT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EPC",
- "name":"EPC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EQM",
- "name":"EQM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EQUAL",
- "name":"EQUAL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ERC",
- "name":"ERC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ERC3",
- "name":"ERC3",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ESB",
- "name":"ESB",
- "statuses":[
- "secondary"
- ]
- },
- {
- "code":"ESC",
- "name":"ESC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ESP",
- "name":"ESP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ETCO",
- "name":"ETCO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ETH",
- "name":"Ethereum",
- "statuses":[
- "primary",
- "secondary"
- ]
- },
- {
- "code":"ETC",
- "name":"Ethereum Classic",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ETHS",
- "name":"ETHS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EUC",
- "name":"EUC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EUR",
- "name":"Euro",
- "statuses":[
- "primary",
- "secondary"
- ]
- },
- {
- "code":"EGC",
- "name":"EvergreenCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EVIL",
- "name":"EVIL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EXCL",
- "name":"EXCL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"EXP",
- "name":"Expanse",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FCT",
- "name":"Factom",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FAIR",
- "name":"Faircoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FC2",
- "name":"FC2",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FCH",
- "name":"FCH",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FCN",
- "name":"FCN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FCP",
- "name":"FCP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FTC",
- "name":"Feathercoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TIPS",
- "name":"Fedoracoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FIND",
- "name":"FIND",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FIT",
- "name":"FIT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FJC",
- "name":"FJC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FLO",
- "name":"Florincoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FLOZ",
- "name":"FLOZ",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FLT",
- "name":"FlutterCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FLY",
- "name":"Flycoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FLDC",
- "name":"FoldingCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FOREX",
- "name":"FOREX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FRK",
- "name":"Franko",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FRDC",
- "name":"FRDC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FRC",
- "name":"Freicoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FRN",
- "name":"FRN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FRWC",
- "name":"FRWC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FSN",
- "name":"FSN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FST",
- "name":"FST",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FTP",
- "name":"FTP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FUEL",
- "name":"FUEL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FUN",
- "name":"FUN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FUTC",
- "name":"FUTC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FUZZ",
- "name":"FUZZ",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"FX",
- "name":"FX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GAIA",
- "name":"GAIA",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GAIN",
- "name":"GAIN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GAKH",
- "name":"GAKH",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GAM",
- "name":"GAM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GBT",
- "name":"GameBet Coin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GAME",
- "name":"GameCredits",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GAP",
- "name":"Gapcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GARY",
- "name":"GARY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GB",
- "name":"GB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GBC",
- "name":"GBC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GBIT",
- "name":"GBIT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GBRC",
- "name":"GBRC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GCN",
- "name":"GCN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GENE",
- "name":"GENE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GEO",
- "name":"GeoCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GEMZ",
- "name":"GetGems",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GHOST",
- "name":"GHOST",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GHS",
- "name":"GHS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GLC",
- "name":"GLC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"BSTY",
- "name":"GlobalBoost-Y",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GMCX",
- "name":"GMCX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GML",
- "name":"GML",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GMX",
- "name":"GMX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GOAT",
- "name":"GOAT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GCR",
- "name":"GoCoineR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GLD",
- "name":"GoldCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GOON",
- "name":"GOON",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GOTX",
- "name":"GOTX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GP",
- "name":"GP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GPU",
- "name":"GPU",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GRF",
- "name":"Graffiti",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GRAM",
- "name":"GRAM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GRT",
- "name":"Grantcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GREED",
- "name":"GREED",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GRC",
- "name":"Gridcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GRN",
- "name":"GRN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GRS",
- "name":"Groestlcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GROW",
- "name":"GrowCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GRW",
- "name":"GRW",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GSY",
- "name":"GSY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GUA",
- "name":"GUA",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NLG",
- "name":"Gulden",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GUM",
- "name":"GUM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GUN",
- "name":"GUN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"GYC",
- "name":"GYC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HALLO",
- "name":"HALLO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HAM",
- "name":"HAM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HBT",
- "name":"HBT",
- "statuses":[
- "secondary"
- ]
- },
- {
- "code":"HCC",
- "name":"HCC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HEAT",
- "name":"HEAT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HMP",
- "name":"HempCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XHI",
- "name":"HiCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HILL",
- "name":"HILL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HODL",
- "name":"HOdlcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HKD",
- "name":"Hong Kong Dollar",
- "statuses":[
- "secondary"
- ]
- },
- {
- "code":"HZ",
- "name":"Horizon",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HSP",
- "name":"HSP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HTC",
- "name":"HTC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HTML5",
- "name":"HTMLCOIN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HUC",
- "name":"HUC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HVCO",
- "name":"HVCO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HXX",
- "name":"HXX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HYPER",
- "name":"Hyper",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"HYP",
- "name":"HyperStake",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"IBANK",
- "name":"IBANK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ICASH",
- "name":"iCash",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ICN",
- "name":"iCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"IFLT",
- "name":"IFLT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"IMPS",
- "name":"IMPS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"INCP",
- "name":"INCP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"IFC",
- "name":"Infinitecoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"INFX",
- "name":"Influxcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"IOC",
- "name":"IO Coin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ION",
- "name":"ION",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ISL",
- "name":"IslaCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"IVZ",
- "name":"IVZ",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"IXC",
- "name":"IXC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"JPY",
- "name":"Japanese Yen",
- "statuses":[
- "secondary"
- ]
- },
- {
- "code":"JOBS",
- "name":"JOBS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"JPC",
- "name":"JPC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"JBS",
- "name":"Jumbucks",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"JW",
- "name":"JW",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"JWL",
- "name":"JWL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"KAT",
- "name":"KAT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"KC",
- "name":"KC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"KNC",
- "name":"KhanCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"KLC",
- "name":"KLC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"KOBO",
- "name":"KOBO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"KORE",
- "name":"KoreCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"KRAK",
- "name":"KRAK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"KRB",
- "name":"KRB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"KRC",
- "name":"KRC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"KRYP",
- "name":"KRYP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"KR",
- "name":"Krypton",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"KTK",
- "name":"KTK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LANA",
- "name":"LANA",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LAZ",
- "name":"LAZ",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LBC",
- "name":"LBC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LC",
- "name":"LC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LEA",
- "name":"LeaCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LEAF",
- "name":"LEAF",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LEO",
- "name":"LEO",
- "statuses":[
- "primary",
- "secondary"
- ]
- },
- {
- "code":"LFC",
- "name":"LFC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LFO",
- "name":"LFO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LFTC",
- "name":"LFTC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LGBTQ",
- "name":"LGBTQ",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LIR",
- "name":"LIR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LSK",
- "name":"Lisk",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LTC",
- "name":"Litecoin",
- "statuses":[
- "primary",
- "secondary"
- ]
- },
- {
- "code":"LTCR",
- "name":"Litecred",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LIV",
- "name":"LIV",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LKC",
- "name":"LKC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LOC",
- "name":"LOC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LOOT",
- "name":"LOOT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LTBC",
- "name":"LTBcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LTH",
- "name":"LTH",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LTS",
- "name":"LTS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LUCKY",
- "name":"LUCKY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LUN",
- "name":"LUN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LXC",
- "name":"LXC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MAD",
- "name":"MAD",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XMG",
- "name":"Magi",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MAID",
- "name":"MaidSafeCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MXT",
- "name":"MarteXcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"OMNI",
- "name":"Mastercoin (Omni)",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MTR",
- "name":"MasterTraderCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MAX",
- "name":"Maxcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MZC",
- "name":"Mazacoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MBL",
- "name":"MBL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MCZ",
- "name":"MCZ",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MED",
- "name":"MediterraneanCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MEGA",
- "name":"MEGA",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MEC",
- "name":"Megacoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MEME",
- "name":"Memetic",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"METAL",
- "name":"METAL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MG",
- "name":"MG",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MND",
- "name":"MindCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MINT",
- "name":"Mintcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MIS",
- "name":"MIS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MMNXT",
- "name":"MMNXT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MMXVI",
- "name":"MMXVI",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MNM",
- "name":"MNM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MOIN",
- "name":"MOIN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MOJO",
- "name":"MojoCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MONA",
- "name":"MonaCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XMR",
- "name":"Monero",
- "statuses":[
- "primary",
- "secondary"
- ]
- },
- {
- "code":"MUE",
- "name":"MonetaryUnit",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MOON",
- "name":"Mooncoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MOOND",
- "name":"MOOND",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MPRO",
- "name":"MPRO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MRB",
- "name":"MRB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MUDRA",
- "name":"MUDRA",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MYR",
- "name":"Myriadcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"N2O",
- "name":"N2O",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"N7",
- "name":"N7",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NMC",
- "name":"Namecoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NAT",
- "name":"NAT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NAUT",
- "name":"Nautiluscoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NAV",
- "name":"NAV Coin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NBIT",
- "name":"NBIT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NCS",
- "name":"NCS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NDOGE",
- "name":"NDOGE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XEM",
- "name":"NEM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NEOS",
- "name":"NeosCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NET",
- "name":"NetCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NEU",
- "name":"NeuCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NTRN",
- "name":"Neutron",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NEVA",
- "name":"NevaCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NEWB",
- "name":"NEWB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NXS",
- "name":"Nexus",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NIC",
- "name":"NIC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NICE",
- "name":"NICE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NKC",
- "name":"NKC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NLC",
- "name":"NLC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NOBL",
- "name":"NobleCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NODES",
- "name":"NODES",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NVC",
- "name":"Novacoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NRS",
- "name":"NRS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NTC",
- "name":"NTC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NBT",
- "name":"NuBits",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NUKE",
- "name":"NUKE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NUM",
- "name":"NUM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NSR",
- "name":"NuShares",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NXE",
- "name":"NXE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NXT",
- "name":"NXT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NXTTY",
- "name":"Nxttycoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NYC",
- "name":"NYC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NZC",
- "name":"NZC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"NZD",
- "name":"NZD",
- "statuses":[
- "primary",
- "secondary"
- ]
- },
- {
- "code":"OBS",
- "name":"OBS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"OCOW",
- "name":"OCOW",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"OK",
- "name":"OKCash",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"OLYMP",
- "name":"OLYMP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"OMC",
- "name":"OMC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ONE",
- "name":"ONE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"OP",
- "name":"OP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"OPAL",
- "name":"OPAL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ORB",
- "name":"Orbitcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"OZC",
- "name":"OZC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PAC",
- "name":"PAC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PAL",
- "name":"PAL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PND",
- "name":"Pandacoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PARA",
- "name":"PARA",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PAY",
- "name":"PAY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XPY",
- "name":"Paycoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PBC",
- "name":"PBC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PCM",
- "name":"PCM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PCS",
- "name":"PCS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PDC",
- "name":"PDC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PEC",
- "name":"PEC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PPC",
- "name":"Peercoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PEN",
- "name":"PEN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PHR",
- "name":"PHR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PIN",
- "name":"PIN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PC",
- "name":"Pinkcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PIO",
- "name":"PIO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PIZZA",
- "name":"PIZZA",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PKB",
- "name":"PKB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PLN",
- "name":"PLN",
- "statuses":[
- "primary",
- "secondary"
- ]
- },
- {
- "code":"PLNC",
- "name":"PLNC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PNK",
- "name":"PNK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"POKE",
- "name":"POKE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PONZ2",
- "name":"PONZ2",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PONZI",
- "name":"PONZI",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PEX",
- "name":"PosEx",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"POST",
- "name":"POST",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"POT",
- "name":"Potcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PRE",
- "name":"PRE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PRES",
- "name":"PRES",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PXI",
- "name":"Prime-XI",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PRIME",
- "name":"PrimeChain",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XPM",
- "name":"Primecoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PRM",
- "name":"PRM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PRT",
- "name":"PRT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PSB",
- "name":"PSB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PSP",
- "name":"PSP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PSY",
- "name":"PSY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PTC",
- "name":"PTC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PURE",
- "name":"PURE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PUTIN",
- "name":"PUTIN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PWR",
- "name":"PWR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PX",
- "name":"PX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"PXL",
- "name":"PXL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"QBC",
- "name":"QBC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"QBK",
- "name":"QBK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"QCN",
- "name":"QCN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"QORA",
- "name":"Qora",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"QTZ",
- "name":"QTZ",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"QRK",
- "name":"Quark",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"QTL",
- "name":"Quatloo",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RADI",
- "name":"RADI",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RADS",
- "name":"Radium",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XRA",
- "name":"RateCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RBIT",
- "name":"RBIT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RCN",
- "name":"RCN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RED",
- "name":"RED",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RDD",
- "name":"Reddcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"REE",
- "name":"REE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"REV",
- "name":"Revenu",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RICHX",
- "name":"RICHX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RIC",
- "name":"Riecoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RBT",
- "name":"Rimbit",
- "statuses":[
- "primary",
- "secondary"
- ]
- },
- {
- "code":"RIO",
- "name":"RIO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XRP",
- "name":"Ripple",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RISE",
- "name":"RISE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RMS",
- "name":"RMS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RONIN",
- "name":"RONIN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ROYAL",
- "name":"ROYAL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RPC",
- "name":"RPC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RRT",
- "name":"RRT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RBIES",
- "name":"Rubies",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RUBIT",
- "name":"RUBIT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RUR",
- "name":"Ruble",
- "statuses":[
- "secondary"
- ]
- },
- {
- "code":"RBY",
- "name":"Rubycoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RUST",
- "name":"RUST",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"RYCN",
- "name":"RYCN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SEC",
- "name":"Safe Exchange Coin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SAK",
- "name":"SAK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SAR",
- "name":"SAR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SBD",
- "name":"SBD",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SCAN",
- "name":"SCAN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SCB",
- "name":"SCB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SCN",
- "name":"SCN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SCOT",
- "name":"Scotcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SCRPT",
- "name":"SCRPT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SCRT",
- "name":"SCRT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SCT",
- "name":"SCT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SRC",
- "name":"SecureCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SED",
- "name":"SED",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SXC",
- "name":"Sexcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SGD",
- "name":"SGD",
- "statuses":[
- "primary",
- "secondary"
- ]
- },
- {
- "code":"SH",
- "name":"SH",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SDC",
- "name":"ShadowCash",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SHELL",
- "name":"SHELL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SHI",
- "name":"SHI",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SHIFT",
- "name":"Shift",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SC",
- "name":"Siacoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SIB",
- "name":"Siberian chervonets",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SIGU",
- "name":"SIGU",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SLFI",
- "name":"SLFI",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SLING",
- "name":"Sling",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SLK",
- "name":"SLK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SLS",
- "name":"SLS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SMC",
- "name":"SMC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SMLY",
- "name":"SmileyCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SNGLS",
- "name":"SNGLS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SNRG",
- "name":"SNRG",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SOIL",
- "name":"SOILcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SLR",
- "name":"Solarcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SONG",
- "name":"SongCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SOON",
- "name":"SOON",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SP",
- "name":"SP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SPACE",
- "name":"SPACE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SPEX",
- "name":"SPEX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SPHR",
- "name":"Sphere",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SPKTR",
- "name":"SPKTR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SPN",
- "name":"SPN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SPORT",
- "name":"SPORT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SPR",
- "name":"SpreadCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SPT",
- "name":"SPT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SPX",
- "name":"SPX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SSC",
- "name":"SSC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"STA",
- "name":"STA",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"STAR",
- "name":"STAR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"START",
- "name":"Startcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"STE",
- "name":"STE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XST",
- "name":"Stealthcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"STEEM",
- "name":"Steem",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XLM",
- "name":"Stellar",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"STR",
- "name":"Stellar",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"STEPS",
- "name":"Steps",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SLG",
- "name":"Sterlingcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"STHR",
- "name":"STHR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"STL",
- "name":"STL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"STO",
- "name":"STO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SJCX",
- "name":"Storjcoin X",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"STP",
- "name":"STP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"STRAT",
- "name":"STRAT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"STS",
- "name":"Stress",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"STV",
- "name":"STV",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SUB",
- "name":"Subcriptio",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"UNITY",
- "name":"SuperNET",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SWEET",
- "name":"SWEET",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SWING",
- "name":"SWING",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SYNC",
- "name":"SYNC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"AMP",
- "name":"Synereo",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SYNX",
- "name":"SYNX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"SYS",
- "name":"Syscoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TAB",
- "name":"TAB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TAG",
- "name":"TagCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TAJ",
- "name":"TAJ",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TAK",
- "name":"TAK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TAO",
- "name":"TAO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TBC",
- "name":"TBC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TC",
- "name":"TC",
- "statuses":[
- "secondary"
- ]
- },
- {
- "code":"TCOIN",
- "name":"TCOIN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TCR",
- "name":"TCR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TDFB",
- "name":"TDFB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TDY",
- "name":"TDY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TEAM",
- "name":"TEAM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TEC",
- "name":"TEC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TECH",
- "name":"TECH",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TEK",
- "name":"TEKcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TRC",
- "name":"Terracoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TESLA",
- "name":"TESLA",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TES",
- "name":"TeslaCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TET",
- "name":"TET",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"THC",
- "name":"THC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"DAO",
- "name":"The DAO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TIA",
- "name":"TIA",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TIX",
- "name":"Tickets",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XTC",
- "name":"TileCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TIT",
- "name":"Titcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TMC",
- "name":"TMC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TNG",
- "name":"TNG",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TODAY",
- "name":"TODAY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TOKEN",
- "name":"TOKEN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TP1",
- "name":"TP1",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TPC",
- "name":"TPC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TPG",
- "name":"TPG",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TX",
- "name":"Transfercoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TRAP",
- "name":"TRAP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TRICK",
- "name":"TRICK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TRIG",
- "name":"TRIG",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TROLL",
- "name":"TROLL",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TRK",
- "name":"Truckcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TRUMP",
- "name":"TrumpCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TRUST",
- "name":"TRUST",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TSC",
- "name":"TSC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TWERK",
- "name":"TWERK",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TWIST",
- "name":"TWIST",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"TWO",
- "name":"TWO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"UAE",
- "name":"UAE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"UB",
- "name":"UB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"UFO",
- "name":"UFO Coin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"UIS",
- "name":"UIS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"UAH",
- "name":"Ukrainian Hryvnia",
- "statuses":[
- "secondary"
- ]
- },
- {
- "code":"UTC",
- "name":"UltraCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"UNB",
- "name":"UNB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"UNC",
- "name":"UNC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"UNF",
- "name":"Unfed",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"UNIQ",
- "name":"UNIQ",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"UNIT",
- "name":"Universal Currency",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"UNO",
- "name":"Unobtanium",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"URC",
- "name":"URC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"URO",
- "name":"Uro",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"USD",
- "name":"US Dollar",
- "statuses":[
- "primary",
- "secondary"
- ]
- },
- {
- "code":"USDE",
- "name":"USDE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XVC",
- "name":"Vcash",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VCN",
- "name":"VCN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VCOIN",
- "name":"VCOIN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VEC",
- "name":"VEC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VEG",
- "name":"VEG",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XVG",
- "name":"Verge",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VRC",
- "name":"VeriCoin",
- "statuses":[
- "primary",
- "secondary"
- ]
- },
- {
- "code":"VTC",
- "name":"Vertcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VIA",
- "name":"Viacoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VIP",
- "name":"VIP Tokens",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VIRAL",
- "name":"Viral",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VLT",
- "name":"VLT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VOOT",
- "name":"VootCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VOX",
- "name":"Voxels",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VOYA",
- "name":"VOYA",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VPN",
- "name":"VPNCoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VRM",
- "name":"VRM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VRS",
- "name":"VRS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VTA",
- "name":"VTA",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VTN",
- "name":"VTN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VTR",
- "name":"VTR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"VTY",
- "name":"VTY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WA",
- "name":"WA",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WAC",
- "name":"WAC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WARP",
- "name":"WARP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WASH",
- "name":"WASH",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WAV",
- "name":"WAV",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WAVES",
- "name":"WAVES",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WAY",
- "name":"WAY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WCN",
- "name":"WCN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WEX",
- "name":"WEX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WGC",
- "name":"WGC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XWC",
- "name":"Whitecoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WBB",
- "name":"Wild Beast Block",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WINE",
- "name":"WINE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WLC",
- "name":"WLC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WMC",
- "name":"WMC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"LOG",
- "name":"Woodcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WDC",
- "name":"Worldcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"WRP",
- "name":"WRP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"X2",
- "name":"X2",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"X2C",
- "name":"X2C",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XAB",
- "name":"XAB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XAUR",
- "name":"XAUR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XAU",
- "name":"Xaurum",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XBS",
- "name":"XBS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XBTS",
- "name":"XBTS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XBU",
- "name":"XBU",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XCO",
- "name":"XCO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XC",
- "name":"XCurrency",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XDB",
- "name":"XDB",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XDE2",
- "name":"XDE2",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"MI",
- "name":"Xiaomicoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XID",
- "name":"XID",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XJO",
- "name":"XJO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XLTCG",
- "name":"XLTCG",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XMINE",
- "name":"XMINE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XMS",
- "name":"XMS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XNG",
- "name":"XNG",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XODUS",
- "name":"XODUS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XPC",
- "name":"XPC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XPO",
- "name":"XPO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XPOKE",
- "name":"XPOKE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XPRO",
- "name":"XPRO",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XPTX",
- "name":"XPTX",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XQN",
- "name":"XQN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XRC",
- "name":"XRC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XSEED",
- "name":"XSEED",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XSY",
- "name":"XSY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XTP",
- "name":"XTP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XUP",
- "name":"XUP",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"YAC",
- "name":"Yacoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"YAY",
- "name":"YAY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"YBC",
- "name":"Ybcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"YMC",
- "name":"YMC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"YOC",
- "name":"YOC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"YOVI",
- "name":"YOVI",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"YUM",
- "name":"YUM",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZEC",
- "name":"Zcash",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZCL",
- "name":"Zcash classic",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZCC",
- "name":"ZCC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZCOIN",
- "name":"ZCOIN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"XZC",
- "name":"Zcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZECD",
- "name":"ZECD",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZEIT",
- "name":"Zeitcoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZET2",
- "name":"ZET2",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZET",
- "name":"Zetacoin",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZRC",
- "name":"ZiftrCOIN",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZLQ",
- "name":"ZLQ",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZMC",
- "name":"ZMC",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZNE",
- "name":"ZNE",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZNY",
- "name":"ZNY",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZS",
- "name":"ZS",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZUR",
- "name":"ZUR",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZXT",
- "name":"ZXT",
- "statuses":[
- "primary"
- ]
- },
- {
- "code":"ZYD",
- "name":"ZYD",
- "statuses":[
- "primary"
- ]
- }
- ]
-} \ No newline at end of file
+{
+ "rows": [
+ {
+ "code": "REP",
+ "name": "Augur",
+ "statuses": [
+ "primary"
+ ]
+ },
+ {
+ "code": "BCN",
+ "name": "Bytecoin",
+ "statuses": [
+ "primary"
+ ]
+ },
+ {
+ "code": "BTC",
+ "name": "Bitcoin",
+ "statuses": [
+ "primary",
+ "secondary"
+ ]
+ },
+ {
+ "code": "BTS",
+ "name": "BitShares",
+ "statuses": [
+ "primary",
+ "secondary"
+ ]
+ },
+ {
+ "code": "BLK",
+ "name": "Blackcoin",
+ "statuses": [
+ "primary"
+ ]
+ },
+ {
+ "code": "GBP",
+ "name": "British Pound Sterling",
+ "statuses": [
+ "secondary"
+ ]
+ },
+ {
+ "code": "CAD",
+ "name": "Canadian Dollar",
+ "statuses": [
+ "secondary"
+ ]
+ },
+ {
+ "code": "CNY",
+ "name": "Chinese Yuan",
+ "statuses": [
+ "secondary"
+ ]
+ },
+ {
+ "code": "DSH",
+ "name": "Dashcoin",
+ "statuses": [
+ "primary"
+ ]
+ },
+ {
+ "code": "DOGE",
+ "name": "Dogecoin",
+ "statuses": [
+ "primary",
+ "secondary"
+ ]
+ },
+ {
+ "code": "ETC",
+ "name": "Ethereum Classic",
+ "statuses": [
+ "primary"
+ ]
+ },
+ {
+ "code": "EUR",
+ "name": "Euro",
+ "statuses": [
+ "primary",
+ "secondary"
+ ]
+ },
+ {
+ "code": "GNO",
+ "name": "GNO",
+ "statuses": [
+ "primary"
+ ]
+ },
+ {
+ "code": "GNT",
+ "name": "GNT",
+ "statuses": [
+ "primary"
+ ]
+ },
+ {
+ "code": "JPY",
+ "name": "Japanese Yen",
+ "statuses": [
+ "secondary"
+ ]
+ },
+ {
+ "code": "LTC",
+ "name": "Litecoin",
+ "statuses": [
+ "primary",
+ "secondary"
+ ]
+ },
+ {
+ "code": "MAID",
+ "name": "MaidSafeCoin",
+ "statuses": [
+ "primary"
+ ]
+ },
+ {
+ "code": "XEM",
+ "name": "NEM",
+ "statuses": [
+ "primary"
+ ]
+ },
+ {
+ "code": "XLM",
+ "name": "Stellar",
+ "statuses": [
+ "primary"
+ ]
+ },
+ {
+ "code": "XMR",
+ "name": "Monero",
+ "statuses": [
+ "primary",
+ "secondary"
+ ]
+ },
+ {
+ "code": "XRP",
+ "name": "Ripple",
+ "statuses": [
+ "primary"
+ ]
+ },
+ {
+ "code": "RUR",
+ "name": "Ruble",
+ "statuses": [
+ "secondary"
+ ]
+ },
+ {
+ "code": "STEEM",
+ "name": "Steem",
+ "statuses": [
+ "primary"
+ ]
+ },
+ {
+ "code": "STRAT",
+ "name": "STRAT",
+ "statuses": [
+ "primary"
+ ]
+ },
+ {
+ "code": "UAH",
+ "name": "Ukrainian Hryvnia",
+ "statuses": [
+ "secondary"
+ ]
+ },
+ {
+ "code": "USD",
+ "name": "US Dollar",
+ "statuses": [
+ "primary",
+ "secondary"
+ ]
+ },
+ {
+ "code": "WAVES",
+ "name": "WAVES",
+ "statuses": [
+ "primary"
+ ]
+ },
+ {
+ "code": "ZEC",
+ "name": "Zcash",
+ "statuses": [
+ "primary"
+ ]
+ }
+ ]
+}
diff --git a/ui/app/css/index.css b/ui/app/css/index.css
index 033502f5a..808aafb4c 100644
--- a/ui/app/css/index.css
+++ b/ui/app/css/index.css
@@ -489,6 +489,47 @@ input.large-input {
}
/* buy eth warning screen */
+.custom-radios {
+ justify-content: space-around;
+ align-items: center;
+}
+
+
+.custom-radio-selected {
+ width: 17px;
+ height: 17px;
+ border: solid;
+ border-style: double;
+ border-radius: 15px;
+ border-width: 5px;
+ background: rgba(247, 134, 28, 1);
+ border-color: #F7F7F7;
+}
+
+.custom-radio-inactive {
+ width: 14px;
+ height: 14px;
+ border: solid;
+ border-width: 1px;
+ border-radius: 24px;
+ border-color: #AEAEAE;
+}
+
+.radio-titles {
+ color: rgba(247, 134, 28, 1);
+}
+
+.radio-titles-subtext {
+
+}
+
+.selected-exchange {
+
+}
+
+.buy-radio {
+
+}
.eth-warning{
transition: opacity 400ms ease-in, transform 400ms ease-in;
diff --git a/ui/app/css/lib.css b/ui/app/css/lib.css
index 670dc9fd0..910a24ee2 100644
--- a/ui/app/css/lib.css
+++ b/ui/app/css/lib.css
@@ -191,6 +191,10 @@ hr.horizontal-line {
border: 3px solid #690496;
}
+.golden-square {
+ background: #EBB33F;
+}
+
.pending-dot {
background: red;
left: 14px;
diff --git a/ui/app/info.js b/ui/app/info.js
index a6fdeb315..aa4503b62 100644
--- a/ui/app/info.js
+++ b/ui/app/info.js
@@ -52,7 +52,7 @@ InfoScreen.prototype.render = function () {
h('div', {
style: {
- marginBottom: '10px',
+ marginBottom: '5px',
}},
[
h('div', [
@@ -87,7 +87,7 @@ InfoScreen.prototype.render = function () {
h('hr', {
style: {
- margin: '20px 0 ',
+ margin: '10px 0 ',
width: '7em',
},
}),
@@ -97,6 +97,13 @@ InfoScreen.prototype.render = function () {
paddingLeft: '30px',
}},
[
+ h('div.fa.fa-github', [
+ h('a.info', {
+ href: 'https://github.com/MetaMask/faq',
+ target: '_blank',
+ onClick (event) { this.navigateTo(event.target.href) },
+ }, 'Need Help? Read our FAQ!'),
+ ]),
h('div', [
h('a', {
href: 'https://metamask.io/',
@@ -138,14 +145,6 @@ InfoScreen.prototype.render = function () {
onClick () { this.navigateTo('mailto:help@metamask.io?subject=Feedback') },
}, 'Email us!'),
]),
-
- h('div.fa.fa-github', [
- h('a.info', {
- href: 'https://github.com/MetaMask/metamask-plugin/issues',
- target: '_blank',
- onClick (event) { this.navigateTo(event.target.href) },
- }, 'Start a thread on GitHub'),
- ]),
]),
]),
]),
diff --git a/ui/app/reducers.js b/ui/app/reducers.js
index c656af849..11efca529 100644
--- a/ui/app/reducers.js
+++ b/ui/app/reducers.js
@@ -44,6 +44,7 @@ function rootReducer (state, action) {
window.logState = function () {
var stateString = JSON.stringify(window.METAMASK_CACHED_LOG_STATE, removeSeedWords, 2)
console.log(stateString)
+ return stateString
}
function removeSeedWords (key, value) {
diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js
index 7ad1229e5..deacad0a7 100644
--- a/ui/app/reducers/app.js
+++ b/ui/app/reducers/app.js
@@ -315,7 +315,7 @@ function reduceApp (state, action) {
case actions.COMPLETED_TX:
log.debug('reducing COMPLETED_TX for tx ' + action.value)
const otherUnconfActions = getUnconfActionList(state)
- .filter(tx => tx.id !== action.value )
+ .filter(tx => tx.id !== action.value)
const hasOtherUnconfActions = otherUnconfActions.length > 0
if (hasOtherUnconfActions) {
@@ -469,8 +469,9 @@ function reduceApp (state, action) {
name: 'buyEth',
context: appState.currentView.name,
},
+ identity: state.metamask.identities[action.value],
buyView: {
- subview: 'buyForm',
+ subview: 'Coinbase',
amount: '15.00',
buyAddress: action.value,
formView: {
@@ -480,36 +481,10 @@ function reduceApp (state, action) {
},
})
- case actions.UPDATE_BUY_ADDRESS:
- return extend(appState, {
- buyView: {
- subview: 'buyForm',
- formView: {
- coinbase: appState.buyView.formView.coinbase,
- shapeshift: appState.buyView.formView.shapeshift,
- },
- buyAddress: action.value,
- amount: appState.buyView.amount,
- },
- })
-
- case actions.UPDATE_COINBASE_AMOUNT:
- return extend(appState, {
- buyView: {
- subview: 'buyForm',
- formView: {
- coinbase: true,
- shapeshift: false,
- },
- buyAddress: appState.buyView.buyAddress,
- amount: action.value,
- },
- })
-
case actions.COINBASE_SUBVIEW:
return extend(appState, {
buyView: {
- subview: 'buyForm',
+ subview: 'Coinbase',
formView: {
coinbase: true,
shapeshift: false,
@@ -522,7 +497,7 @@ function reduceApp (state, action) {
case actions.SHAPESHIFT_SUBVIEW:
return extend(appState, {
buyView: {
- subview: 'buyForm',
+ subview: 'ShapeShift',
formView: {
coinbase: false,
shapeshift: true,
@@ -537,7 +512,7 @@ function reduceApp (state, action) {
case actions.PAIR_UPDATE:
return extend(appState, {
buyView: {
- subview: 'buyForm',
+ subview: 'ShapeShift',
formView: {
coinbase: false,
shapeshift: true,
diff --git a/ui/app/send.js b/ui/app/send.js
index eb32d5e06..fd6994145 100644
--- a/ui/app/send.js
+++ b/ui/app/send.js
@@ -21,6 +21,8 @@ function mapStateToProps (state) {
warning: state.appState.warning,
network: state.metamask.network,
addressBook: state.metamask.addressBook,
+ conversionRate: state.metamask.conversionRate,
+ currentCurrency: state.metamask.currentCurrency,
}
result.error = result.warning && result.warning.split('.')[0]
@@ -40,13 +42,17 @@ function SendTransactionScreen () {
SendTransactionScreen.prototype.render = function () {
this.persistentFormParentId = 'send-tx-form'
- var state = this.props
- var address = state.address
- var account = state.account
- var identity = state.identity
- var network = state.network
- var identities = state.identities
- var addressBook = state.addressBook
+ const props = this.props
+ const {
+ address,
+ account,
+ identity,
+ network,
+ identities,
+ addressBook,
+ conversionRate,
+ currentCurrency,
+ } = props
return (
@@ -125,6 +131,8 @@ SendTransactionScreen.prototype.render = function () {
h(EthBalance, {
value: account && account.balance,
+ conversionRate,
+ currentCurrency,
}),
]),
@@ -147,7 +155,7 @@ SendTransactionScreen.prototype.render = function () {
]),
// error message
- state.error && h('span.error.flex-center', state.error),
+ props.error && h('span.error.flex-center', props.error),
// 'to' field
h('section.flex-row.flex-center', [
diff --git a/ui/app/util.js b/ui/app/util.js
index 7a56bf6a0..ac3f42c6b 100644
--- a/ui/app/util.js
+++ b/ui/app/util.js
@@ -61,6 +61,7 @@ function miniAddressSummary (address) {
function isValidAddress (address) {
var prefixed = ethUtil.addHexPrefix(address)
+ if (address === '0x0000000000000000000000000000000000000000') return false
return (isAllOneCase(prefixed) && ethUtil.isValidAddress(prefixed)) || ethUtil.isValidChecksumAddress(prefixed)
}
diff --git a/ui/lib/account-link.js b/ui/lib/account-link.js
index 4f27b35c0..d061d0ad1 100644
--- a/ui/lib/account-link.js
+++ b/ui/lib/account-link.js
@@ -11,6 +11,9 @@ module.exports = function (address, network) {
case 3: // ropsten test net
link = `http://ropsten.etherscan.io/address/${address}`
break
+ case 4: // rinkeby test net
+ link = `http://rinkeby.etherscan.io/address/${address}`
+ break
case 42: // kovan test net
link = `http://kovan.etherscan.io/address/${address}`
break
diff --git a/ui/lib/contract-namer.js b/ui/lib/contract-namer.js
index a94c62b62..f05e770cc 100644
--- a/ui/lib/contract-namer.js
+++ b/ui/lib/contract-namer.js
@@ -5,14 +5,18 @@
* otherwise returns null.
*/
-// Nickname keys must be stored in lower case.
-const nicknames = {}
+const contractMap = require('eth-contract-metadata')
+const ethUtil = require('ethereumjs-util')
module.exports = function (addr, identities = {}) {
+ const checksummed = ethUtil.toChecksumAddress(addr)
+ if (contractMap[checksummed] && contractMap[checksummed].name) {
+ return contractMap[checksummed].name
+ }
+
const address = addr.toLowerCase()
const ids = hashFromIdentities(identities)
-
- return addrFromHash(address, ids) || addrFromHash(address, nicknames)
+ return addrFromHash(address, ids)
}
function hashFromIdentities (identities) {
diff --git a/ui/lib/explorer-link.js b/ui/lib/explorer-link.js
index ca89f8b25..e11249551 100644
--- a/ui/lib/explorer-link.js
+++ b/ui/lib/explorer-link.js
@@ -8,6 +8,9 @@ module.exports = function (hash, network) {
case 3: // ropsten test net
prefix = 'ropsten.'
break
+ case 4: // rinkeby test net
+ prefix = 'rinkeby.'
+ break
case 42: // kovan test net
prefix = 'kovan.'
break
diff --git a/ui/lib/icon-factory.js b/ui/lib/icon-factory.js
index ac703ae40..4ee6b600b 100644
--- a/ui/lib/icon-factory.js
+++ b/ui/lib/icon-factory.js
@@ -1,4 +1,7 @@
var iconFactory
+const isValidAddress = require('ethereumjs-util').isValidAddress
+const toChecksumAddress = require('ethereumjs-util').toChecksumAddress
+const contractMap = require('eth-contract-metadata')
module.exports = function (jazzicon) {
if (!iconFactory) {
@@ -10,48 +13,15 @@ module.exports = function (jazzicon) {
function IconFactory (jazzicon) {
this.jazzicon = jazzicon
this.cache = {}
-
- this.presets = {
- '1':{ // Main network:
- '0x48c80f1f4d53d5951e5d5438b54cba84f29f32a5': 'https://etherscan.io/token/images/augur.png',
- '0xc66ea802717bfb9833400264dd12c2bceaa34a6d': 'https://etherscan.io/token/images/mkr-etherscan-35.png',
- '0xa74476443119a942de498590fe1f2454d7d4ac0d': 'https://etherscan.io/token/images/golem.png',
- '0xaec2e87e0a235266d9c5adc9deb4b2e29b54d009': 'https://etherscan.io/token/images/sngls.png',
-
- }
- }
}
-IconFactory.prototype.iconForAddress = function (address, diameter, imageify, network) {
-
- try {
- const presetUri = this.presets[network][address.toLowerCase()]
- if (presetUri) {
- var img = document.createElement('img')
- img.src = presetUri
- img.style.width = `${diameter}px`
- img.style.height = `${diameter}px`
- img.style.borderRadius = `${diameter/2}px`
- return img
- }
- } catch (e) {}
-
-
- if (imageify) {
- return this.generateIdenticonImg(address, diameter)
- } else {
- return this.generateIdenticonSvg(address, diameter)
+IconFactory.prototype.iconForAddress = function (address, diameter) {
+ const addr = toChecksumAddress(address)
+ if (iconExistsFor(addr)) {
+ return imageElFor(addr)
}
-}
-// returns img dom element
-IconFactory.prototype.generateIdenticonImg = function (address, diameter) {
- var identicon = this.generateIdenticonSvg(address, diameter)
- var identiconSrc = identicon.innerHTML
- var dataUri = toDataUri(identiconSrc)
- var img = document.createElement('img')
- img.src = dataUri
- return img
+ return this.generateIdenticonSvg(address, diameter)
}
// returns svg dom element
@@ -73,12 +43,23 @@ IconFactory.prototype.generateNewIdenticon = function (address, diameter) {
// util
+function iconExistsFor (address) {
+ return (contractMap.address) && isValidAddress(address) && (contractMap[address].logo)
+}
+
+function imageElFor (address) {
+ const contract = contractMap[address]
+ const fileName = contract.logo
+ const path = `images/contract/${fileName}`
+ const img = document.createElement('img')
+ img.src = path
+ img.style.width = '100%'
+ return img
+}
+
function jsNumberForAddress (address) {
var addr = address.slice(2, 10)
var seed = parseInt(addr, 16)
return seed
}
-function toDataUri (identiconSrc) {
- return 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(identiconSrc)
-}