aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-09-13 02:51:22 +0800
committerkumavis <aaron@kumavis.me>2017-09-13 02:51:22 +0800
commit114dae5f8070e47409a01981f2aeff96827cbf41 (patch)
treebe37b3fd47a9f95c27d812d1d97b3858fe64a469
parent8545453a9d58d7a54c10beef52e38107ed937117 (diff)
parentcafebb6417331d9d0a0a83fdc1cc4fdb04d0a5ec (diff)
downloadtangerine-wallet-browser-114dae5f8070e47409a01981f2aeff96827cbf41.tar.gz
tangerine-wallet-browser-114dae5f8070e47409a01981f2aeff96827cbf41.tar.zst
tangerine-wallet-browser-114dae5f8070e47409a01981f2aeff96827cbf41.zip
Merge branch 'master' of github.com:MetaMask/metamask-extension into filter-leak-fix3
-rw-r--r--CHANGELOG.md8
-rw-r--r--app/manifest.json2
-rw-r--r--circle.yml13
-rw-r--r--docs/add-to-firefox.md (renamed from docs/add-to-firef.md)0
-rw-r--r--karma.conf.js61
-rw-r--r--mock-dev.js73
-rw-r--r--package.json12
-rw-r--r--test/integration/helpers.js7
-rw-r--r--test/integration/index.js19
-rw-r--r--test/integration/lib/first-time.js198
-rw-r--r--testem.yml10
-rw-r--r--ui/app/actions.js11
-rw-r--r--ui/app/components/account-export.js28
-rw-r--r--ui/app/components/pending-tx.js36
-rw-r--r--ui/app/conf-tx.js10
-rw-r--r--ui/app/config.js7
-rw-r--r--ui/app/keychains/hd/create-vault-complete.js10
-rw-r--r--ui/app/util.js16
18 files changed, 339 insertions, 182 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5e1956ad5..89eaefa79 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,10 +1,18 @@
# Changelog
## Current Master
+
+- Add ability to export private keys as a file.
+- Add ability to export seed words as a file.
+- Changed state logs to a file download than a clipboard copy.
+
+## 3.10.0 2017-9-11
+
- Readded loose keyring label back into the account list.
- Remove cryptonator from chrome permissions.
- Add info on token contract addresses.
- Add validation preventing users from inputting their own addresses as token tracking addresses.
+- Added button to reject all transactions (thanks to davidp94! https://github.com/davidp94)
## 3.9.13 2017-9-8
diff --git a/app/manifest.json b/app/manifest.json
index f597bec7f..bd25c1f6f 100644
--- a/app/manifest.json
+++ b/app/manifest.json
@@ -1,7 +1,7 @@
{
"name": "MetaMask",
"short_name": "Metamask",
- "version": "3.9.13",
+ "version": "3.10.0",
"manifest_version": 2,
"author": "https://metamask.io",
"description": "Ethereum Browser Extension",
diff --git a/circle.yml b/circle.yml
index e81e1bcaa..f5da6857d 100644
--- a/circle.yml
+++ b/circle.yml
@@ -3,4 +3,15 @@ machine:
version: 8.1.4
test:
override:
- - "npm run ci" \ No newline at end of file
+ - "npm run ci"
+dependencies:
+ pre:
+ - sudo apt-get update
+ # get latest stable firefox
+ - sudo apt-get install firefox
+ - firefox_cmd=`which firefox`; sudo rm -f $firefox_cmd; sudo ln -s `which firefox.ubuntu` $firefox_cmd
+ # get latest stable chrome
+ - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
+ - sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
+ - sudo apt-get update
+ - sudo apt-get install google-chrome-stable \ No newline at end of file
diff --git a/docs/add-to-firef.md b/docs/add-to-firefox.md
index 593d06170..593d06170 100644
--- a/docs/add-to-firef.md
+++ b/docs/add-to-firefox.md
diff --git a/karma.conf.js b/karma.conf.js
new file mode 100644
index 000000000..8e6d55972
--- /dev/null
+++ b/karma.conf.js
@@ -0,0 +1,61 @@
+// Karma configuration
+// Generated on Mon Sep 11 2017 18:45:48 GMT-0700 (PDT)
+
+module.exports = function(config) {
+ config.set({
+ // base path that will be used to resolve all patterns (eg. files, exclude)
+ basePath: process.cwd(),
+
+ browserConsoleLogOptions: {
+ terminal: false,
+ },
+
+ // frameworks to use
+ // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
+ frameworks: ['qunit'],
+
+ // list of files / patterns to load in the browser
+ files: [
+ 'development/bundle.js',
+ 'test/integration/jquery-3.1.0.min.js',
+ 'test/integration/bundle.js',
+ { pattern: 'dist/chrome/images/**/*.*', watched: false, included: false, served: true },
+ { pattern: 'dist/chrome/fonts/**/*.*', watched: false, included: false, served: true },
+ ],
+
+ proxies: {
+ '/images/': '/base/dist/chrome/images/',
+ '/fonts/': '/base/dist/chrome/fonts/',
+ },
+
+ // test results reporter to use
+ // possible values: 'dots', 'progress'
+ // available reporters: https://npmjs.org/browse/keyword/karma-reporter
+ reporters: ['progress'],
+
+ // web server port
+ port: 9876,
+
+ // enable / disable colors in the output (reporters and logs)
+ colors: true,
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ logLevel: config.LOG_INFO,
+
+ // enable / disable watching file and executing tests whenever any file changes
+ autoWatch: false,
+
+ // start these browsers
+ // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
+ browsers: ['Chrome', 'Firefox'],
+
+ // Continuous Integration mode
+ // if true, Karma captures browsers, runs the tests and exits
+ singleRun: true,
+
+ // Concurrency level
+ // how many browser should be started simultaneous
+ concurrency: Infinity
+ })
+}
diff --git a/mock-dev.js b/mock-dev.js
index 8e1923a82..b6652bdf7 100644
--- a/mock-dev.js
+++ b/mock-dev.js
@@ -85,40 +85,47 @@ actions.update = function(stateName) {
var css = MetaMaskUiCss()
injectCss(css)
-const container = document.querySelector('#app-content')
-
// parse opts
var store = configureStore(firstState)
// start app
-render(
- h('.super-dev-container', [
-
- h('button', {
- onClick: (ev) => {
- ev.preventDefault()
- store.dispatch(actions.update('terms'))
- },
- style: {
- margin: '19px 19px 0px 19px',
- },
- }, 'Reset State'),
-
- h(Selector, { actions, selectedKey: selectedView, states, store }),
-
- h('.mock-app-root', {
- style: {
- height: '500px',
- width: '360px',
- boxShadow: 'grey 0px 2px 9px',
- margin: '20px',
- },
- }, [
- h(Root, {
- store: store,
- }),
- ]),
-
- ]
-), container)
-
+startApp()
+
+function startApp(){
+ const body = document.body
+ const container = document.createElement('div')
+ container.id = 'app-content'
+ body.appendChild(container)
+ console.log('container', container)
+
+ render(
+ h('.super-dev-container', [
+
+ h('button', {
+ onClick: (ev) => {
+ ev.preventDefault()
+ store.dispatch(actions.update('terms'))
+ },
+ style: {
+ margin: '19px 19px 0px 19px',
+ },
+ }, 'Reset State'),
+
+ h(Selector, { actions, selectedKey: selectedView, states, store }),
+
+ h('.mock-app-root', {
+ style: {
+ height: '500px',
+ width: '360px',
+ boxShadow: 'grey 0px 2px 9px',
+ margin: '20px',
+ },
+ }, [
+ h(Root, {
+ store: store,
+ }),
+ ]),
+
+ ]
+ ), container)
+}
diff --git a/package.json b/package.json
index 571c76485..b241ccfc6 100644
--- a/package.json
+++ b/package.json
@@ -12,8 +12,8 @@
"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\"",
"single-test": "METAMASK_ENV=test mocha --require test/helper.js",
- "test-integration": "npm run buildMock && npm run buildCiUnits && testem ci -P 2",
- "test-coverage": "nyc npm run test-unit && nyc report --reporter=text-lcov | coveralls",
+ "test-integration": "npm run buildMock && npm run buildCiUnits && karma start",
+ "test-coverage": "nyc npm run test-unit && if [ $COVERALLS_REPO_TOKEN ]; then nyc report --reporter=text-lcov | coveralls; fi",
"ci": "npm run lint && npm run test-coverage && npm run test-integration",
"lint": "gulp lint",
"buildCiUnits": "node test/integration/index.js",
@@ -22,7 +22,6 @@
"ui": "npm run genStates && beefy ui-dev.js:bundle.js --live --open --index=./development/index.html --cwd ./",
"mock": "beefy mock-dev.js:bundle.js --live --open --index=./development/index.html --cwd ./",
"buildMock": "npm run genStates && browserify ./mock-dev.js -o ./development/bundle.js",
- "testem": "npm run buildMock && testem",
"announce": "node development/announcer.js",
"generateNotice": "node notices/notice-generator.js",
"deleteNotice": "node notices/notice-delete.js",
@@ -142,7 +141,7 @@
},
"devDependencies": {
"babel-core": "^6.24.1",
- "babel-eslint": "^7.2.3",
+ "babel-eslint": "^8.0.0",
"babel-plugin-transform-async-to-generator": "^6.24.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.23.0",
@@ -176,6 +175,11 @@
"jsdom-global": "^3.0.2",
"jshint-stylish": "~2.2.1",
"json-rpc-engine": "^3.0.1",
+ "karma": "^1.7.1",
+ "karma-chrome-launcher": "^2.2.0",
+ "karma-cli": "^1.0.1",
+ "karma-firefox-launcher": "^1.0.1",
+ "karma-qunit": "^1.2.1",
"lodash.assign": "^4.0.6",
"mocha": "^3.4.2",
"mocha-eslint": "^4.0.0",
diff --git a/test/integration/helpers.js b/test/integration/helpers.js
deleted file mode 100644
index 10cd74e64..000000000
--- a/test/integration/helpers.js
+++ /dev/null
@@ -1,7 +0,0 @@
-function wait(time) {
- 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 e089fc39b..144303dbb 100644
--- a/test/integration/index.js
+++ b/test/integration/index.js
@@ -1,5 +1,6 @@
const fs = require('fs')
const path = require('path')
+const pump = require('pump')
const browserify = require('browserify')
const tests = fs.readdirSync(path.join(__dirname, 'lib'))
const bundlePath = path.join(__dirname, 'bundle.js')
@@ -9,11 +10,17 @@ const b = browserify()
const writeStream = fs.createWriteStream(bundlePath)
tests.forEach(function (fileName) {
- b.add(path.join(__dirname, 'lib', fileName))
+ const filePath = path.join(__dirname, 'lib', fileName)
+ console.log(`bundling test "${filePath}"`)
+ b.add(filePath)
})
-b.bundle()
-.pipe(writeStream)
-.on('error', (err) => {
- throw err
-})
+pump(
+ b.bundle(),
+ writeStream,
+ (err) => {
+ if (err) throw err
+ console.log(`Integration test build completed: "${bundlePath}"`)
+ process.exit(0)
+ }
+) \ No newline at end of file
diff --git a/test/integration/lib/first-time.js b/test/integration/lib/first-time.js
index 0e4b802da..38a94e551 100644
--- a/test/integration/lib/first-time.js
+++ b/test/integration/lib/first-time.js
@@ -2,125 +2,137 @@ const PASSWORD = 'password123'
QUnit.module('first time usage')
-QUnit.test('render init screen', function (assert) {
- var done = assert.async()
- let app
-
- wait().then(function() {
- app = $('iframe').contents().find('#app-content .mock-app-root')
-
- 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()
- }
+QUnit.test('render init screen', (assert) => {
+ const done = assert.async()
+ runFirstTimeUsageTest(assert).then(done).catch((err) => {
+ assert.notOk(err, `Error was thrown: ${err.stack}`)
+ done()
+ })
+})
+
+// QUnit.testDone(({ module, name, total, passed, failed, skipped, todo, runtime }) => {
+// if (failed > 0) {
+// const app = $('iframe').contents()[0].documentElement
+// console.warn('Test failures - dumping DOM:')
+// console.log(app.innerHTML)
+// }
+// })
+
+async function runFirstTimeUsageTest(assert, done) {
+
+ await timeout()
+
+ const app = $('#app-content .mock-app-root')
+
+ // recurse notices
+ while (true) {
+ const button = app.find('button')
+ if (button.html() === 'Accept') {
+ // still notices to accept
+ const termsPage = app.find('.markdown')[0]
+ termsPage.scrollTop = termsPage.scrollHeight
+ await timeout()
+ button.click()
+ await timeout()
+ } else {
+ // exit loop
+ break
}
- 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
+ await timeout()
- return wait()
- }).then(function() {
+ // Scroll through terms
+ const title = app.find('h1').text()
+ assert.equal(title, 'MetaMask', 'title screen')
- // create vault
- var createButton = app.find('button.primary')[0]
- createButton.click()
+ // enter password
+ const pwBox = app.find('#password-box')[0]
+ const confBox = app.find('#password-box-confirm')[0]
+ pwBox.value = PASSWORD
+ confBox.value = PASSWORD
- return wait(1500)
- }).then(function() {
+ await timeout()
- var created = app.find('h3')[0]
- assert.equal(created.textContent, 'Vault Created', 'Vault created screen')
+ // create vault
+ const createButton = app.find('button.primary')[0]
+ createButton.click()
- // Agree button
- var button = app.find('button')[0]
- assert.ok(button, 'button present')
- button.click()
+ await timeout(1500)
- return wait(1000)
- }).then(function() {
+ const created = app.find('h3')[0]
+ assert.equal(created.textContent, 'Vault Created', 'Vault created screen')
- var detail = app.find('.account-detail-section')[0]
- assert.ok(detail, 'Account detail section loaded.')
+ // Agree button
+ const button = app.find('button')[0]
+ assert.ok(button, 'button present')
+ button.click()
- var sandwich = app.find('.sandwich-expando')[0]
- sandwich.click()
+ await timeout(1000)
- return wait()
- }).then(function() {
+ const detail = app.find('.account-detail-section')[0]
+ assert.ok(detail, 'Account detail section loaded.')
- 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()
+ const sandwich = app.find('.sandwich-expando')[0]
+ sandwich.click()
- return wait(1000)
- }).then(function() {
+ await timeout()
- var pwBox = app.find('#password-box')[0]
- pwBox.value = PASSWORD
+ const menu = app.find('.menu-droppo')[0]
+ const children = menu.children
+ const lock = children[children.length - 2]
+ assert.ok(lock, 'Lock menu item found')
+ lock.click()
- var createButton = app.find('button.primary')[0]
- createButton.click()
+ await timeout(1000)
- return wait(1000)
- }).then(function() {
+ const pwBox2 = app.find('#password-box')[0]
+ pwBox2.value = PASSWORD
- var detail = app.find('.account-detail-section')[0]
- assert.ok(detail, 'Account detail section loaded again.')
+ const createButton2 = app.find('button.primary')[0]
+ createButton2.click()
- return wait()
- }).then(function (){
+ await timeout(1000)
- var qrButton = app.find('.fa.fa-ellipsis-h')[0] // open account settings dropdown
- qrButton.click()
+ const detail2 = app.find('.account-detail-section')[0]
+ assert.ok(detail2, 'Account detail section loaded again.')
- return wait(1000)
- }).then(function (){
+ await timeout()
- var qrButton = app.find('.dropdown-menu-item')[1] // qr code item
- qrButton.click()
+ // open account settings dropdown
+ const qrButton = app.find('.fa.fa-ellipsis-h')[0]
+ qrButton.click()
- return wait(1000)
- }).then(function (){
+ await timeout(1000)
- 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')
+ // qr code item
+ const qrButton2 = app.find('.dropdown-menu-item')[1]
+ qrButton2.click()
- return wait()
- }).then(function (){
+ await timeout(1000)
- var networkMenu = app.find('.network-indicator')[0]
- networkMenu.click()
+ const qrHeader = app.find('.qr-header')[0]
+ const 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 (){
+ await timeout()
- var networkMenu = app.find('.network-indicator')[0]
- var children = networkMenu.children
- children.length[3]
- assert.ok(children, 'All network options present')
+ const networkMenu = app.find('.network-indicator')[0]
+ networkMenu.click()
- done()
+ await timeout()
+
+ const networkMenu2 = app.find('.network-indicator')[0]
+ const children2 = networkMenu2.children
+ children2.length[3]
+ assert.ok(children2, 'All network options present')
+}
+
+function timeout(time) {
+ return new Promise(function (resolve, reject) {
+ setTimeout(function () {
+ resolve()
+ }, time * 3 || 1500)
})
-})
+} \ No newline at end of file
diff --git a/testem.yml b/testem.yml
deleted file mode 100644
index 2cf40f7f4..000000000
--- a/testem.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-launch_in_dev:
- - Chrome
- - Firefox
-launch_in_ci:
- - Chrome
- - Firefox
-framework:
- - qunit
-before_tests: "npm run buildCiUnits"
-test_page: "test/integration/index.html"
diff --git a/ui/app/actions.js b/ui/app/actions.js
index eebe65ba2..e793e6a21 100644
--- a/ui/app/actions.js
+++ b/ui/app/actions.js
@@ -104,6 +104,7 @@ var actions = {
txError: txError,
nextTx: nextTx,
previousTx: previousTx,
+ cancelAllTx: cancelAllTx,
viewPendingTx: viewPendingTx,
VIEW_PENDING_TX: 'VIEW_PENDING_TX',
// app messages
@@ -457,6 +458,16 @@ function cancelTx (txData) {
}
}
+function cancelAllTx (txsData) {
+ return (dispatch) => {
+ txsData.forEach((txData, i) => {
+ background.cancelTransaction(txData.id, () => {
+ dispatch(actions.completedTx(txData.id))
+ i === txsData.length - 1 ? dispatch(actions.goHome()) : null
+ })
+ })
+ }
+}
//
// initialize screen
//
diff --git a/ui/app/components/account-export.js b/ui/app/components/account-export.js
index 330f73805..32b103c86 100644
--- a/ui/app/components/account-export.js
+++ b/ui/app/components/account-export.js
@@ -1,6 +1,7 @@
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
+const exportAsFile = require('../util').exportAsFile
const copyToClipboard = require('copy-to-clipboard')
const actions = require('../actions')
const ethUtil = require('ethereumjs-util')
@@ -20,20 +21,21 @@ function mapStateToProps (state) {
}
ExportAccountView.prototype.render = function () {
- var state = this.props
- var accountDetail = state.accountDetail
+ const state = this.props
+ const accountDetail = state.accountDetail
+ const nickname = state.identities[state.address].name
if (!accountDetail) return h('div')
- var accountExport = accountDetail.accountExport
+ const accountExport = accountDetail.accountExport
- var notExporting = accountExport === 'none'
- var exportRequested = accountExport === 'requested'
- var accountExported = accountExport === 'completed'
+ const notExporting = accountExport === 'none'
+ const exportRequested = accountExport === 'requested'
+ const accountExported = accountExport === 'completed'
if (notExporting) return h('div')
if (exportRequested) {
- var warning = `Export private keys at your own risk.`
+ const warning = `Export private keys at your own risk.`
return (
h('div', {
style: {
@@ -89,6 +91,8 @@ ExportAccountView.prototype.render = function () {
}
if (accountExported) {
+ const plainKey = ethUtil.stripHexPrefix(accountDetail.privateKey)
+
return h('div.privateKey', {
style: {
margin: '0 20px',
@@ -105,10 +109,16 @@ ExportAccountView.prototype.render = function () {
onClick: function (event) {
copyToClipboard(ethUtil.stripHexPrefix(accountDetail.privateKey))
},
- }, ethUtil.stripHexPrefix(accountDetail.privateKey)),
+ }, plainKey),
h('button', {
onClick: () => this.props.dispatch(actions.backToAccountDetail(this.props.address)),
}, 'Done'),
+ h('button', {
+ style: {
+ marginLeft: '10px',
+ },
+ onClick: () => exportAsFile(`MetaMask ${nickname} Private Key`, plainKey),
+ }, 'Save as File'),
])
}
}
@@ -117,6 +127,6 @@ ExportAccountView.prototype.onExportKeyPress = function (event) {
if (event.key !== 'Enter') return
event.preventDefault()
- var input = document.getElementById('exportAccount').value
+ const input = document.getElementById('exportAccount').value
this.props.dispatch(actions.exportAccount(input, this.props.address))
}
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js
index 5324ccd64..3e53d47f9 100644
--- a/ui/app/components/pending-tx.js
+++ b/ui/app/components/pending-tx.js
@@ -66,6 +66,8 @@ PendingTx.prototype.render = function () {
const balanceBn = hexToBn(balance)
const insufficientBalance = balanceBn.lt(maxCost)
+ const buyDisabled = insufficientBalance || !this.state.valid || !isValidAddress || this.state.submitting
+ const showRejectAll = props.unconfTxListLength > 1
this.inputs = []
@@ -297,14 +299,6 @@ PendingTx.prototype.render = function () {
margin: '14px 25px',
},
}, [
-
-
- insufficientBalance ?
- h('button.btn-green', {
- onClick: props.buyEth,
- }, 'Buy Ether')
- : null,
-
h('button', {
onClick: (event) => {
this.resetGasFields()
@@ -312,18 +306,30 @@ PendingTx.prototype.render = function () {
},
}, 'Reset'),
- // Accept Button
- h('input.confirm.btn-green', {
- type: 'submit',
- value: 'SUBMIT',
- style: { marginLeft: '10px' },
- disabled: insufficientBalance || !this.state.valid || !isValidAddress || this.state.submitting,
- }),
+ // Accept Button or Buy Button
+ insufficientBalance ? h('button.btn-green', { onClick: props.buyEth }, 'Buy Ether') :
+ h('input.confirm.btn-green', {
+ type: 'submit',
+ value: 'SUBMIT',
+ style: { marginLeft: '10px' },
+ disabled: buyDisabled,
+ }),
h('button.cancel.btn-red', {
onClick: props.cancelTransaction,
}, 'Reject'),
]),
+ showRejectAll ? h('.flex-row.flex-space-around.conf-buttons', {
+ style: {
+ display: 'flex',
+ justifyContent: 'flex-end',
+ margin: '14px 25px',
+ },
+ }, [
+ h('button.cancel.btn-red', {
+ onClick: props.cancelAllTransactions,
+ }, 'Reject All'),
+ ]) : null,
]),
])
)
diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js
index 34727ff78..1ee4166f7 100644
--- a/ui/app/conf-tx.js
+++ b/ui/app/conf-tx.js
@@ -52,6 +52,8 @@ ConfirmTxScreen.prototype.render = function () {
log.info(`rendering a combined ${unconfTxList.length} unconf msg & txs`)
if (unconfTxList.length === 0) return h(Loading, { isLoading: true })
+ const unconfTxListLength = unconfTxList.length
+
return (
h('.flex-column.flex-grow', [
@@ -101,10 +103,12 @@ ConfirmTxScreen.prototype.render = function () {
conversionRate,
currentCurrency,
blockGasLimit,
+ unconfTxListLength,
// Actions
buyEth: this.buyEth.bind(this, txParams.from || props.selectedAddress),
sendTransaction: this.sendTransaction.bind(this),
cancelTransaction: this.cancelTransaction.bind(this, txData),
+ cancelAllTransactions: this.cancelAllTransactions.bind(this, unconfTxList),
signMessage: this.signMessage.bind(this, txData),
signPersonalMessage: this.signPersonalMessage.bind(this, txData),
cancelMessage: this.cancelMessage.bind(this, txData),
@@ -151,6 +155,12 @@ ConfirmTxScreen.prototype.cancelTransaction = function (txData, event) {
this.props.dispatch(actions.cancelTx(txData))
}
+ConfirmTxScreen.prototype.cancelAllTransactions = function (unconfTxList, event) {
+ this.stopPropagation(event)
+ event.preventDefault()
+ this.props.dispatch(actions.cancelAllTx(unconfTxList))
+}
+
ConfirmTxScreen.prototype.signMessage = function (msgData, event) {
log.info('conf-tx.js: signing message')
var params = msgData.msgParams
diff --git a/ui/app/config.js b/ui/app/config.js
index 62785c49b..d64088ccb 100644
--- a/ui/app/config.js
+++ b/ui/app/config.js
@@ -5,7 +5,8 @@ const connect = require('react-redux').connect
const actions = require('./actions')
const currencies = require('./conversion.json').rows
const validUrl = require('valid-url')
-const copyToClipboard = require('copy-to-clipboard')
+const exportAsFile = require('./util').exportAsFile
+
module.exports = connect(mapStateToProps)(ConfigScreen)
@@ -110,9 +111,9 @@ ConfigScreen.prototype.render = function () {
alignSelf: 'center',
},
onClick (event) {
- copyToClipboard(window.logState())
+ exportAsFile('MetaMask State Logs', window.logState())
},
- }, 'Copy State Logs'),
+ }, 'Download State Logs'),
]),
h('hr.horizontal-line'),
diff --git a/ui/app/keychains/hd/create-vault-complete.js b/ui/app/keychains/hd/create-vault-complete.js
index c32751fff..745990351 100644
--- a/ui/app/keychains/hd/create-vault-complete.js
+++ b/ui/app/keychains/hd/create-vault-complete.js
@@ -3,6 +3,7 @@ const Component = require('react').Component
const connect = require('react-redux').connect
const h = require('react-hyperscript')
const actions = require('../../actions')
+const exportAsFile = require('../../util').exportAsFile
module.exports = connect(mapStateToProps)(CreateVaultCompleteScreen)
@@ -65,8 +66,17 @@ CreateVaultCompleteScreen.prototype.render = function () {
style: {
margin: '24px',
fontSize: '0.9em',
+ marginBottom: '10px',
},
}, 'I\'ve copied it somewhere safe'),
+
+ h('button.primary', {
+ onClick: () => exportAsFile(`MetaMask Seed Words`, seed),
+ style: {
+ margin: '10px',
+ fontSize: '0.9em',
+ },
+ }, 'Save Seed Words As File'),
])
)
}
diff --git a/ui/app/util.js b/ui/app/util.js
index ac3f42c6b..1368ebf11 100644
--- a/ui/app/util.js
+++ b/ui/app/util.js
@@ -36,6 +36,7 @@ module.exports = {
valueTable: valueTable,
bnTable: bnTable,
isHex: isHex,
+ exportAsFile: exportAsFile,
}
function valuesFor (obj) {
@@ -215,3 +216,18 @@ function readableDate (ms) {
function isHex (str) {
return Boolean(str.match(/^(0x)?[0-9a-fA-F]+$/))
}
+
+function exportAsFile (filename, data) {
+ // source: https://stackoverflow.com/a/33542499 by Ludovic Feltz
+ const blob = new Blob([data], {type: 'text/csv'})
+ if (window.navigator.msSaveOrOpenBlob) {
+ window.navigator.msSaveBlob(blob, filename)
+ } else {
+ const elem = window.document.createElement('a')
+ elem.href = window.URL.createObjectURL(blob)
+ elem.download = filename
+ document.body.appendChild(elem)
+ elem.click()
+ document.body.removeChild(elem)
+ }
+}