aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorChi Kei Chan <chikeichan@gmail.com>2017-10-26 10:46:42 +0800
committerChi Kei Chan <chikeichan@gmail.com>2017-10-26 10:46:42 +0800
commitdb5326dfc288015a4d9f792653a71fd4d7abca33 (patch)
treecb93f52f999816d07a6146274093aaebdb7ed8d3 /app
parenta9a841ba01f6bffa29a3e0491e3a88f6aff72ac7 (diff)
parentb2e440e4ffba6db29cf8a928a41534c1f204d485 (diff)
downloadtangerine-wallet-browser-db5326dfc288015a4d9f792653a71fd4d7abca33.tar
tangerine-wallet-browser-db5326dfc288015a4d9f792653a71fd4d7abca33.tar.gz
tangerine-wallet-browser-db5326dfc288015a4d9f792653a71fd4d7abca33.tar.bz2
tangerine-wallet-browser-db5326dfc288015a4d9f792653a71fd4d7abca33.tar.lz
tangerine-wallet-browser-db5326dfc288015a4d9f792653a71fd4d7abca33.tar.xz
tangerine-wallet-browser-db5326dfc288015a4d9f792653a71fd4d7abca33.tar.zst
tangerine-wallet-browser-db5326dfc288015a4d9f792653a71fd4d7abca33.zip
Merge branch 'NewUI-flat' into uat
Diffstat (limited to 'app')
-rw-r--r--app/images/caret-right.svg76
-rw-r--r--app/images/check-white.svg14
-rw-r--r--app/images/info-logo.pngbin0 -> 32567 bytes
-rw-r--r--app/notification.html4
-rw-r--r--app/scripts/controllers/computed-balances.js8
-rw-r--r--app/scripts/controllers/network.js6
-rw-r--r--app/scripts/inpage.js10
-rw-r--r--app/scripts/lib/createLoggerMiddleware.js4
-rw-r--r--app/scripts/lib/createOriginMiddleware.js4
-rw-r--r--app/scripts/lib/createProviderMiddleware.js5
-rw-r--r--app/scripts/lib/events-proxy.js4
-rw-r--r--app/scripts/lib/nodeify.js4
-rw-r--r--app/scripts/lib/notification-manager.js2
-rw-r--r--app/scripts/lib/pending-balance-calculator.js2
-rw-r--r--app/scripts/lib/pending-tx-tracker.js12
-rw-r--r--app/scripts/lib/port-stream.js2
-rw-r--r--app/scripts/lib/tx-gas-utils.js2
-rw-r--r--app/scripts/lib/tx-state-history-helper.js10
-rw-r--r--app/scripts/lib/tx-state-manager.js2
19 files changed, 134 insertions, 37 deletions
diff --git a/app/images/caret-right.svg b/app/images/caret-right.svg
new file mode 100644
index 000000000..8981ac254
--- /dev/null
+++ b/app/images/caret-right.svg
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ viewBox="0 0 1000 1000" style="enable-background:new 0 0 1000 1000;" xml:space="preserve">
+<style type="text/css">
+ .st0{fill:#231F20;}
+ .st1{fill:none;stroke:#000000;stroke-width:35;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
+
+ .st2{fill:none;stroke:#000000;stroke-width:35;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:25,61;}
+ .st3{display:none;}
+ .st4{display:inline;}
+ .st5{fill:#EC008C;}
+ .st6{display:inline;fill:#FFF200;}
+</style>
+<g id="Layer_4">
+</g>
+<g id="Layer_1">
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <g>
+ <path class="st0" d="M380.4,756.7c-4.5,0-9-1.7-12.4-5.1c-6.8-6.8-6.8-17.9,0-24.7L594.9,500L368,273.2
+ c-6.8-6.8-6.8-17.9,0-24.7c6.8-6.8,17.9-6.8,24.7,0L632,487.6c6.8,6.8,6.8,17.9,0,24.7L392.8,751.6
+ C389.3,755,384.9,756.7,380.4,756.7z"/>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+ </g>
+</g>
+<g id="Layer_2" class="st3">
+</g>
+</svg>
diff --git a/app/images/check-white.svg b/app/images/check-white.svg
new file mode 100644
index 000000000..0f15667da
--- /dev/null
+++ b/app/images/check-white.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="16px" height="13px" viewBox="0 0 16 13" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <!-- Generator: Sketch 47 (45396) - http://www.bohemiancoding.com/sketch -->
+ <title>check-white</title>
+ <desc>Created with Sketch.</desc>
+ <defs></defs>
+ <g id="MetaMascara-v2" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <g id="account-dropdown-top-bar-IXD" transform="translate(-17.000000, -80.000000)" fill-rule="nonzero" fill="#FFFFFF">
+ <g id="Group-11" transform="translate(18.000000, 74.000000)">
+ <polygon id="check-white" points="4.2 15.5712828 0.714212839 12.0143571 -0.714212839 13.4142143 4.2 18.4287172 14.7142128 7.69992858 13.2857872 6.30007142"></polygon>
+ </g>
+ </g>
+ </g>
+</svg> \ No newline at end of file
diff --git a/app/images/info-logo.png b/app/images/info-logo.png
new file mode 100644
index 000000000..f654ed5b1
--- /dev/null
+++ b/app/images/info-logo.png
Binary files differ
diff --git a/app/notification.html b/app/notification.html
index be38f4aa3..f10cbbf41 100644
--- a/app/notification.html
+++ b/app/notification.html
@@ -1,5 +1,5 @@
<!doctype html>
-<html>
+<html style="height:600px;">
<head>
<meta charset="utf-8">
<title>MetaMask Notification</title>
@@ -9,7 +9,7 @@
}
</style>
</head>
- <body style="width:350px; height:500px;">
+ <body class="notification" style="height:600px;">
<div id="app-content"></div>
<script src="./scripts/popup.js" type="text/javascript" charset="utf-8"></script>
</body>
diff --git a/app/scripts/controllers/computed-balances.js b/app/scripts/controllers/computed-balances.js
index 9855f715e..907b087cf 100644
--- a/app/scripts/controllers/computed-balances.js
+++ b/app/scripts/controllers/computed-balances.js
@@ -32,13 +32,13 @@ class ComputedbalancesController {
this.accountTracker.store.subscribe(this.syncAllAccountsFromStore.bind(this))
}
- syncAllAccountsFromStore(store) {
+ syncAllAccountsFromStore (store) {
const upstream = Object.keys(store.accounts)
const balances = Object.keys(this.balances)
.map(address => this.balances[address])
// Follow new addresses
- for (let address in balances) {
+ for (const address in balances) {
this.trackAddressIfNotAlready(address)
}
@@ -58,14 +58,14 @@ class ComputedbalancesController {
}
trackAddress (address) {
- let updater = new BalanceController({
+ const updater = new BalanceController({
address,
accountTracker: this.accountTracker,
txController: this.txController,
blockTracker: this.blockTracker,
})
updater.store.subscribe((accountBalance) => {
- let newState = this.store.getState()
+ const newState = this.store.getState()
newState.computedBalances[address] = accountBalance
this.store.updateState(newState)
})
diff --git a/app/scripts/controllers/network.js b/app/scripts/controllers/network.js
index 0f9db4d53..23afdc12b 100644
--- a/app/scripts/controllers/network.js
+++ b/app/scripts/controllers/network.js
@@ -51,6 +51,10 @@ module.exports = class NetworkController extends EventEmitter {
}
lookupNetwork () {
+ // Prevent firing when provider is not defined.
+ if (!this.ethQuery || !this.ethQuery.sendAsync) {
+ return
+ }
this.ethQuery.sendAsync({ method: 'net_version' }, (err, network) => {
if (err) return this.setNetworkState('loading')
log.info('web3.getNetwork returned ' + network)
@@ -101,7 +105,7 @@ module.exports = class NetworkController extends EventEmitter {
this.emit('networkDidChange')
}
- _configureStandardProvider(_providerParams) {
+ _configureStandardProvider (_providerParams) {
const providerParams = extend(this._baseProviderParams, _providerParams)
const provider = createMetamaskProvider(providerParams)
this._setProvider(provider)
diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js
index 9e98c044b..b6889b00f 100644
--- a/app/scripts/inpage.js
+++ b/app/scripts/inpage.js
@@ -1,6 +1,7 @@
/*global Web3*/
cleanContextForImports()
require('web3/dist/web3.min.js')
+const log = require('loglevel')
const LocalMessageDuplexStream = require('post-message-stream')
// const PingStream = require('ping-pong-stream/ping')
// const endOfStream = require('end-of-stream')
@@ -8,6 +9,10 @@ const setupDappAutoReload = require('./lib/auto-reload.js')
const MetamaskInpageProvider = require('./lib/inpage-provider.js')
restoreContextAfterImports()
+const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
+window.log = log
+log.setDefaultLevel(METAMASK_DEBUG ? 'debug' : 'warn')
+
//
// setup plugin communication
@@ -28,9 +33,9 @@ var inpageProvider = new MetamaskInpageProvider(metamaskStream)
var web3 = new Web3(inpageProvider)
web3.setProvider = function () {
- console.log('MetaMask - overrode web3.setProvider')
+ log.debug('MetaMask - overrode web3.setProvider')
}
-console.log('MetaMask - injected web3')
+log.debug('MetaMask - injected web3')
// export global web3, with usage-detection
setupDappAutoReload(web3, inpageProvider.publicConfigStore)
@@ -65,4 +70,3 @@ function restoreContextAfterImports () {
console.warn('MetaMask - global.define could not be overwritten.')
}
}
-
diff --git a/app/scripts/lib/createLoggerMiddleware.js b/app/scripts/lib/createLoggerMiddleware.js
index b92a965de..2707cbd9e 100644
--- a/app/scripts/lib/createLoggerMiddleware.js
+++ b/app/scripts/lib/createLoggerMiddleware.js
@@ -1,7 +1,7 @@
// log rpc activity
module.exports = createLoggerMiddleware
-function createLoggerMiddleware({ origin }) {
+function createLoggerMiddleware ({ origin }) {
return function loggerMiddleware (req, res, next, end) {
next((cb) => {
if (res.error) {
@@ -12,4 +12,4 @@ function createLoggerMiddleware({ origin }) {
cb()
})
}
-} \ No newline at end of file
+}
diff --git a/app/scripts/lib/createOriginMiddleware.js b/app/scripts/lib/createOriginMiddleware.js
index e1e097cc4..f8bdb2dc2 100644
--- a/app/scripts/lib/createOriginMiddleware.js
+++ b/app/scripts/lib/createOriginMiddleware.js
@@ -1,9 +1,9 @@
// append dapp origin domain to request
module.exports = createOriginMiddleware
-function createOriginMiddleware({ origin }) {
+function createOriginMiddleware ({ origin }) {
return function originMiddleware (req, res, next, end) {
req.origin = origin
next()
}
-} \ No newline at end of file
+}
diff --git a/app/scripts/lib/createProviderMiddleware.js b/app/scripts/lib/createProviderMiddleware.js
index 6dd192411..4e667bac2 100644
--- a/app/scripts/lib/createProviderMiddleware.js
+++ b/app/scripts/lib/createProviderMiddleware.js
@@ -1,8 +1,7 @@
-
module.exports = createProviderMiddleware
// forward requests to provider
-function createProviderMiddleware({ provider }) {
+function createProviderMiddleware ({ provider }) {
return (req, res, next, end) => {
provider.sendAsync(req, (err, _res) => {
if (err) return end(err)
@@ -10,4 +9,4 @@ function createProviderMiddleware({ provider }) {
end()
})
}
-} \ No newline at end of file
+}
diff --git a/app/scripts/lib/events-proxy.js b/app/scripts/lib/events-proxy.js
index d1199a278..c0a490b05 100644
--- a/app/scripts/lib/events-proxy.js
+++ b/app/scripts/lib/events-proxy.js
@@ -1,4 +1,4 @@
-module.exports = function createEventEmitterProxy(eventEmitter, listeners) {
+module.exports = function createEventEmitterProxy (eventEmitter, listeners) {
let target = eventEmitter
const eventHandlers = listeners || {}
const proxy = new Proxy({}, {
@@ -28,4 +28,4 @@ module.exports = function createEventEmitterProxy(eventEmitter, listeners) {
}
if (listeners) proxy.setTarget(eventEmitter)
return proxy
-} \ No newline at end of file
+}
diff --git a/app/scripts/lib/nodeify.js b/app/scripts/lib/nodeify.js
index d24e92206..9b595d93c 100644
--- a/app/scripts/lib/nodeify.js
+++ b/app/scripts/lib/nodeify.js
@@ -1,8 +1,8 @@
const promiseToCallback = require('promise-to-callback')
-const noop = function(){}
+const noop = function () {}
module.exports = function nodeify (fn, context) {
- return function(){
+ return function () {
const args = [].slice.call(arguments)
const lastArg = args[args.length - 1]
const lastArgIsCallback = typeof lastArg === 'function'
diff --git a/app/scripts/lib/notification-manager.js b/app/scripts/lib/notification-manager.js
index 7846ef7f0..adaf60c65 100644
--- a/app/scripts/lib/notification-manager.js
+++ b/app/scripts/lib/notification-manager.js
@@ -1,5 +1,5 @@
const extension = require('extensionizer')
-const height = 520
+const height = 620
const width = 360
diff --git a/app/scripts/lib/pending-balance-calculator.js b/app/scripts/lib/pending-balance-calculator.js
index cea642f1a..6ae526463 100644
--- a/app/scripts/lib/pending-balance-calculator.js
+++ b/app/scripts/lib/pending-balance-calculator.js
@@ -13,7 +13,7 @@ class PendingBalanceCalculator {
this.getNetworkBalance = getBalance
}
- async getBalance() {
+ async getBalance () {
const results = await Promise.all([
this.getNetworkBalance(),
this.getPendingTransactions(),
diff --git a/app/scripts/lib/pending-tx-tracker.js b/app/scripts/lib/pending-tx-tracker.js
index df504c126..0d7c6a92c 100644
--- a/app/scripts/lib/pending-tx-tracker.js
+++ b/app/scripts/lib/pending-tx-tracker.js
@@ -81,14 +81,14 @@ module.exports = class PendingTransactionTracker extends EventEmitter {
const errorMessage = err.message.toLowerCase()
const isKnownTx = (
// geth
- errorMessage.includes('replacement transaction underpriced')
- || errorMessage.includes('known transaction')
+ errorMessage.includes('replacement transaction underpriced') ||
+ errorMessage.includes('known transaction') ||
// parity
- || errorMessage.includes('gas price too low to replace')
- || errorMessage.includes('transaction with the same hash was already imported')
+ errorMessage.includes('gas price too low to replace') ||
+ errorMessage.includes('transaction with the same hash was already imported') ||
// other
- || errorMessage.includes('gateway timeout')
- || errorMessage.includes('nonce too low')
+ errorMessage.includes('gateway timeout') ||
+ errorMessage.includes('nonce too low')
)
// ignore resubmit warnings, return early
if (isKnownTx) return
diff --git a/app/scripts/lib/port-stream.js b/app/scripts/lib/port-stream.js
index 648d88087..a9716fb00 100644
--- a/app/scripts/lib/port-stream.js
+++ b/app/scripts/lib/port-stream.js
@@ -1,6 +1,6 @@
const Duplex = require('readable-stream').Duplex
const inherits = require('util').inherits
-const noop = function(){}
+const noop = function () {}
module.exports = PortDuplexStream
diff --git a/app/scripts/lib/tx-gas-utils.js b/app/scripts/lib/tx-gas-utils.js
index 41f67e230..7e72ea71d 100644
--- a/app/scripts/lib/tx-gas-utils.js
+++ b/app/scripts/lib/tx-gas-utils.js
@@ -81,4 +81,4 @@ module.exports = class txProvideUtil {
throw new Error(`Invalid transaction value of ${txParams.value} not a positive number.`)
}
}
-} \ No newline at end of file
+}
diff --git a/app/scripts/lib/tx-state-history-helper.js b/app/scripts/lib/tx-state-history-helper.js
index db6e3bc9f..94c7b6792 100644
--- a/app/scripts/lib/tx-state-history-helper.js
+++ b/app/scripts/lib/tx-state-history-helper.js
@@ -9,7 +9,7 @@ module.exports = {
}
-function migrateFromSnapshotsToDiffs(longHistory) {
+function migrateFromSnapshotsToDiffs (longHistory) {
return (
longHistory
// convert non-initial history entries into diffs
@@ -20,22 +20,22 @@ function migrateFromSnapshotsToDiffs(longHistory) {
)
}
-function generateHistoryEntry(previousState, newState, note) {
+function generateHistoryEntry (previousState, newState, note) {
const entry = jsonDiffer.compare(previousState, newState)
// Add a note to the first op, since it breaks if we append it to the entry
if (note && entry[0]) entry[0].note = note
return entry
}
-function replayHistory(_shortHistory) {
+function replayHistory (_shortHistory) {
const shortHistory = clone(_shortHistory)
return shortHistory.reduce((val, entry) => jsonDiffer.applyPatch(val, entry).newDocument)
}
-function snapshotFromTxMeta(txMeta) {
+function snapshotFromTxMeta (txMeta) {
// create txMeta snapshot for history
const snapshot = clone(txMeta)
// dont include previous history in this snapshot
delete snapshot.history
return snapshot
-} \ No newline at end of file
+}
diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js
index 2250403f6..0fd6bed4b 100644
--- a/app/scripts/lib/tx-state-manager.js
+++ b/app/scripts/lib/tx-state-manager.js
@@ -91,7 +91,7 @@ module.exports = class TransactionStateManger extends EventEmitter {
updateTx (txMeta, note) {
if (txMeta.txParams) {
Object.keys(txMeta.txParams).forEach((key) => {
- let value = txMeta.txParams[key]
+ const value = txMeta.txParams[key]
if (typeof value !== 'string') console.error(`${key}: ${value} in txParams is not a string`)
if (!ethUtil.isHexPrefixed(value)) console.error('is not hex prefixed, anything on txParams must be hex prefixed')
})