From 61b4b1f947230a8d5157fab27ee8ec82e0826e02 Mon Sep 17 00:00:00 2001 From: sdtsui Date: Wed, 2 Aug 2017 19:13:17 -0700 Subject: Ensure app-header is rendered in responsive layout --- app/scripts/lib/is-popup-or-notification.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/is-popup-or-notification.js b/app/scripts/lib/is-popup-or-notification.js index 693fa8751..73a812d5f 100644 --- a/app/scripts/lib/is-popup-or-notification.js +++ b/app/scripts/lib/is-popup-or-notification.js @@ -1,6 +1,6 @@ module.exports = function isPopupOrNotification () { const url = window.location.href - if (url.match(/popup.html$/)) { + if (url.match(/popup.html$/) || url.match(/home.html$/)) { return 'popup' } else { return 'notification' -- cgit v1.2.3 From dd4586ee84ea0e6a74ad4cd6b6f058169ddd9129 Mon Sep 17 00:00:00 2001 From: sdtsui Date: Wed, 2 Aug 2017 19:26:46 -0700 Subject: Adjust sidebar transition using @cjeria\'s feedback --- app/scripts/lib/environment-type.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 app/scripts/lib/environment-type.js (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/environment-type.js b/app/scripts/lib/environment-type.js new file mode 100644 index 000000000..7966926eb --- /dev/null +++ b/app/scripts/lib/environment-type.js @@ -0,0 +1,10 @@ +module.exports = function environmentType () { + const url = window.location.href + if (url.match(/popup.html$/)) { + return 'popup' + } else if (url.match(/home.html$/)) { + return 'responsive' + } else { + return 'notification' + } +} -- cgit v1.2.3 From bbe893a0d8d759ba750ba78ff8aed0f0876a43ff Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 5 Oct 2017 13:14:45 -0230 Subject: UI for send screen container without form rows. --- app/scripts/lib/is-popup-or-notification.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/is-popup-or-notification.js b/app/scripts/lib/is-popup-or-notification.js index 73a812d5f..e2999411f 100644 --- a/app/scripts/lib/is-popup-or-notification.js +++ b/app/scripts/lib/is-popup-or-notification.js @@ -1,6 +1,9 @@ module.exports = function isPopupOrNotification () { const url = window.location.href - if (url.match(/popup.html$/) || url.match(/home.html$/)) { + // if (url.match(/popup.html$/) || url.match(/home.html$/)) { + // Below regexes needed for feature toggles (e.g. see line ~340 in ui/app/app.js) + // Revert below regexes to above commented out regexes before merge to master + if (url.match(/popup.html(?:\?.+)*$/) || url.match(/home.html(?:\?.+)*$/)) { return 'popup' } else { return 'notification' -- cgit v1.2.3 From ddf11011c9467209e6b9810dff2df84ea9e4a040 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 25 Oct 2017 21:58:56 -0230 Subject: Signature request fixes. --- app/scripts/lib/notification-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/notification-manager.js b/app/scripts/lib/notification-manager.js index 7846ef7f0..98cd3f760 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 = 610 const width = 360 -- cgit v1.2.3 From fa95303e1efef03db6c44878b89ccca680639598 Mon Sep 17 00:00:00 2001 From: Chi Kei Chan Date: Wed, 25 Oct 2017 18:05:52 -0700 Subject: Sign Typed Request styling fixes --- app/scripts/lib/notification-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/notification-manager.js b/app/scripts/lib/notification-manager.js index 98cd3f760..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 = 610 +const height = 620 const width = 360 -- cgit v1.2.3 From ec6c3c33bdbe2d90dc71649d0cc5fb3c07d96af7 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 5 Dec 2017 13:11:59 -0330 Subject: Merge branch 'master' into NewUI-flat-merge-with-master --- app/scripts/lib/inpage-provider.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/inpage-provider.js b/app/scripts/lib/inpage-provider.js index da75c4be2..99cc5d2cf 100644 --- a/app/scripts/lib/inpage-provider.js +++ b/app/scripts/lib/inpage-provider.js @@ -3,6 +3,7 @@ const RpcEngine = require('json-rpc-engine') const createIdRemapMiddleware = require('json-rpc-engine/src/idRemapMiddleware') const createStreamMiddleware = require('json-rpc-middleware-stream') const LocalStorageStore = require('obs-store') +const asStream = require('obs-store/lib/asStream') const ObjectMultiplex = require('obj-multiplex') module.exports = MetamaskInpageProvider @@ -21,9 +22,10 @@ function MetamaskInpageProvider (connectionStream) { // subscribe to metamask public config (one-way) self.publicConfigStore = new LocalStorageStore({ storageKey: 'MetaMask-Config' }) + pump( mux.createStream('publicConfig'), - self.publicConfigStore, + asStream(self.publicConfigStore), (err) => logStreamDisconnectWarning('MetaMask PublicConfigStore', err) ) -- cgit v1.2.3 From e6fda855a556a6aa0325556b074612ff76925e5d Mon Sep 17 00:00:00 2001 From: Bruno Barbieri Date: Wed, 31 Jan 2018 03:33:15 -0500 Subject: added reset account feature --- app/scripts/lib/tx-state-manager.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js index a8ef39891..61ce2024a 100644 --- a/app/scripts/lib/tx-state-manager.js +++ b/app/scripts/lib/tx-state-manager.js @@ -221,6 +221,10 @@ module.exports = class TransactionStateManger extends EventEmitter { this._setTxStatus(txId, 'failed') } + wipeTransactions(){ + this._saveTxList([]); + } + // // PRIVATE METHODS // -- cgit v1.2.3 From 5f39844382fb3106b883efb81f55a6e909f28b01 Mon Sep 17 00:00:00 2001 From: Bruno Barbieri Date: Wed, 31 Jan 2018 03:36:04 -0500 Subject: clean up --- app/scripts/lib/tx-state-manager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js index 61ce2024a..6b4a196f2 100644 --- a/app/scripts/lib/tx-state-manager.js +++ b/app/scripts/lib/tx-state-manager.js @@ -221,10 +221,10 @@ module.exports = class TransactionStateManger extends EventEmitter { this._setTxStatus(txId, 'failed') } - wipeTransactions(){ - this._saveTxList([]); + wipeTransactions () { + this._saveTxList([]); } - + // // PRIVATE METHODS // -- cgit v1.2.3 From 03d17c75ae47806e9afa562cf664819b83a2b926 Mon Sep 17 00:00:00 2001 From: Bruno Barbieri Date: Wed, 31 Jan 2018 04:25:32 -0500 Subject: wipe only transactions for current account --- app/scripts/lib/tx-state-manager.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js index 6b4a196f2..13e645a28 100644 --- a/app/scripts/lib/tx-state-manager.js +++ b/app/scripts/lib/tx-state-manager.js @@ -221,10 +221,16 @@ module.exports = class TransactionStateManger extends EventEmitter { this._setTxStatus(txId, 'failed') } - wipeTransactions () { - this._saveTxList([]); + wipeTransactions (address) { + // network only tx + const txs = this.getTxList() + + // Filter out the ones from the current account + const otherAccountTxs = txs.filter((txMeta) => txMeta.from !== address) + + // Update state + this._saveTxList(otherAccountTxs) } - // // PRIVATE METHODS // -- cgit v1.2.3 From 7dc1b09f94003fdac4ed9ea36ecf1c1a14d972a1 Mon Sep 17 00:00:00 2001 From: Bruno Barbieri Date: Wed, 31 Jan 2018 04:40:32 -0500 Subject: use txMeta.txParams --- app/scripts/lib/tx-state-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js index 13e645a28..f488130a2 100644 --- a/app/scripts/lib/tx-state-manager.js +++ b/app/scripts/lib/tx-state-manager.js @@ -226,7 +226,7 @@ module.exports = class TransactionStateManger extends EventEmitter { const txs = this.getTxList() // Filter out the ones from the current account - const otherAccountTxs = txs.filter((txMeta) => txMeta.from !== address) + const otherAccountTxs = txs.filter((txMeta) => txMeta.txParams.from !== address) // Update state this._saveTxList(otherAccountTxs) -- cgit v1.2.3 From c1b7cfe91d803c0085afe59d058f2422a0e8dc30 Mon Sep 17 00:00:00 2001 From: Bruno Barbieri Date: Wed, 31 Jan 2018 13:29:02 -0500 Subject: preserve other networks TXs --- app/scripts/lib/tx-state-manager.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js index f488130a2..051efd247 100644 --- a/app/scripts/lib/tx-state-manager.js +++ b/app/scripts/lib/tx-state-manager.js @@ -223,10 +223,11 @@ module.exports = class TransactionStateManger extends EventEmitter { wipeTransactions (address) { // network only tx - const txs = this.getTxList() + const txs = this.getFullTxList() + const network = this.getNetwork() - // Filter out the ones from the current account - const otherAccountTxs = txs.filter((txMeta) => txMeta.txParams.from !== address) + // Filter out the ones from the current account and network + const otherAccountTxs = txs.filter((txMeta) => !(txMeta.txParams.from === address && txMeta.metamaskNetworkId === network)) // Update state this._saveTxList(otherAccountTxs) -- cgit v1.2.3 From 7f151b861cc3a565d3feefc50b3be25ab4490ac8 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Wed, 7 Feb 2018 21:08:55 -0330 Subject: [NewUI] Opens to full screen when restoring from seed. (#3201) * Opens to full screen when restoring from seed. * Remove redundant parameter in actions.markPasswordForgotten call. --- app/scripts/lib/config-manager.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js index 9c0dffe9c..34b603b96 100644 --- a/app/scripts/lib/config-manager.js +++ b/app/scripts/lib/config-manager.js @@ -42,6 +42,17 @@ ConfigManager.prototype.getData = function () { return this.store.getState() } +ConfigManager.prototype.setPasswordForgotten = function (passwordForgottenState) { + const data = this.getData() + data.forgottenPassword = passwordForgottenState + this.setData(data) +} + +ConfigManager.prototype.getPasswordForgotten = function (passwordForgottenState) { + const data = this.getData() + return data.forgottenPassword +} + ConfigManager.prototype.setWallet = function (wallet) { var data = this.getData() data.wallet = wallet -- cgit v1.2.3 From 94cd5b9df480a0c2e2897495c9edddd13461f23a Mon Sep 17 00:00:00 2001 From: kumavis Date: Sat, 10 Feb 2018 19:33:33 +0000 Subject: metamask mesh - inject mesh testing container --- app/scripts/lib/setupMetamaskMeshMetrics.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 app/scripts/lib/setupMetamaskMeshMetrics.js (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/setupMetamaskMeshMetrics.js b/app/scripts/lib/setupMetamaskMeshMetrics.js new file mode 100644 index 000000000..40343f017 --- /dev/null +++ b/app/scripts/lib/setupMetamaskMeshMetrics.js @@ -0,0 +1,9 @@ + +module.exports = setupMetamaskMeshMetrics + +function setupMetamaskMeshMetrics() { + const testingContainer = document.createElement('iframe') + testingContainer.src = 'https://metamask.github.io/mesh-testing/' + console.log('Injecting MetaMask Mesh testing client') + document.head.appendChild(testingContainer) +} -- cgit v1.2.3 From dc3f3e79ca7319b97255456a5225a266d38a4d6f Mon Sep 17 00:00:00 2001 From: frankiebee Date: Wed, 14 Feb 2018 14:37:02 -0800 Subject: fix - hex prefix estimatedGas on txMeta --- app/scripts/lib/tx-gas-utils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/tx-gas-utils.js b/app/scripts/lib/tx-gas-utils.js index f68f3a9e2..6f6ff7852 100644 --- a/app/scripts/lib/tx-gas-utils.js +++ b/app/scripts/lib/tx-gas-utils.js @@ -4,6 +4,7 @@ const { BnMultiplyByFraction, bnToHex, } = require('./util') +const addHexPrefix = require('ethereumjs-util').addHexPrefix const SIMPLE_GAS_COST = '0x5208' // Hex for 21000, cost of a simple send. /* @@ -13,7 +14,7 @@ and used to do things like calculate gas of a tx. */ module.exports = class TxGasUtil { - + constructor (provider) { this.query = new EthQuery(provider) } @@ -68,7 +69,7 @@ module.exports = class TxGasUtil { } setTxGas (txMeta, blockGasLimitHex, estimatedGasHex) { - txMeta.estimatedGas = estimatedGasHex + txMeta.estimatedGas = addHexPrefix(estimatedGasHex) const txParams = txMeta.txParams // if gasLimit was specified and doesnt OOG, -- cgit v1.2.3 From 73e5ae6e29d04481cc3ffdd32d5d096e6a10b3b3 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 15 Feb 2018 15:32:48 -0800 Subject: Fix incorrect promise instantiation --- app/scripts/lib/nonce-tracker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/nonce-tracker.js b/app/scripts/lib/nonce-tracker.js index 0029ac953..ed9dd3f11 100644 --- a/app/scripts/lib/nonce-tracker.js +++ b/app/scripts/lib/nonce-tracker.js @@ -56,7 +56,7 @@ class NonceTracker { const blockTracker = this._getBlockTracker() const currentBlock = blockTracker.getCurrentBlock() if (currentBlock) return currentBlock - return await Promise((reject, resolve) => { + return await new Promise((reject, resolve) => { blockTracker.once('latest', resolve) }) } -- cgit v1.2.3 From 98d3fba3efaedb65ee0cf60b4cc3f954a1fd9740 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 20 Feb 2018 15:45:48 -0800 Subject: Fix promise construction --- app/scripts/lib/nonce-tracker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/nonce-tracker.js b/app/scripts/lib/nonce-tracker.js index 0029ac953..ed9dd3f11 100644 --- a/app/scripts/lib/nonce-tracker.js +++ b/app/scripts/lib/nonce-tracker.js @@ -56,7 +56,7 @@ class NonceTracker { const blockTracker = this._getBlockTracker() const currentBlock = blockTracker.getCurrentBlock() if (currentBlock) return currentBlock - return await Promise((reject, resolve) => { + return await new Promise((reject, resolve) => { blockTracker.once('latest', resolve) }) } -- cgit v1.2.3 From fca2cbc8ef8e0d8434fd8c437497a7a0792e2caf Mon Sep 17 00:00:00 2001 From: kumavis Date: Wed, 28 Feb 2018 10:37:53 -0800 Subject: sentry - clean - move setupRaven to lib --- app/scripts/lib/setupRaven.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 app/scripts/lib/setupRaven.js (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/setupRaven.js b/app/scripts/lib/setupRaven.js new file mode 100644 index 000000000..42e48cb90 --- /dev/null +++ b/app/scripts/lib/setupRaven.js @@ -0,0 +1,26 @@ +const Raven = require('../vendor/raven.min.js') +const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG' +const PROD = 'https://3567c198f8a8412082d32655da2961d0@sentry.io/273505' +const DEV = 'https://f59f3dd640d2429d9d0e2445a87ea8e1@sentry.io/273496' + +module.exports = setupRaven + +// Setup raven / sentry remote error reporting +function setupRaven(opts) { + const { release } = opts + let ravenTarget + + if (METAMASK_DEBUG) { + console.log('Setting up Sentry Remote Error Reporting: DEV') + ravenTarget = DEV + } else { + console.log('Setting up Sentry Remote Error Reporting: PROD') + ravenTarget = PROD + } + + Raven.config(ravenTarget, { + release, + }).install() + + return Raven +} -- cgit v1.2.3 From 8e5bcf89359edb70b5d6847a4848c222aa283066 Mon Sep 17 00:00:00 2001 From: kumavis Date: Wed, 28 Feb 2018 10:53:54 -0800 Subject: sentry - failed tx - improve ethjs-rpc error formating --- app/scripts/lib/reportFailedTxToSentry.js | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 app/scripts/lib/reportFailedTxToSentry.js (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/reportFailedTxToSentry.js b/app/scripts/lib/reportFailedTxToSentry.js new file mode 100644 index 000000000..67b0acf43 --- /dev/null +++ b/app/scripts/lib/reportFailedTxToSentry.js @@ -0,0 +1,38 @@ +const ethJsRpcSlug = 'Error: [ethjs-rpc] rpc error with payload ' +const errorLabelPrefix = 'Error: ' + +module.exports = reportFailedTxToSentry + +// +// utility for formatting failed transaction messages +// for sending to sentry +// + +function reportFailedTxToSentry({ raven, txMeta }) { + const errorMessage = extractErrorMessage(txMeta.err.message) + raven.captureMessage(errorMessage, { + // "extra" key is required by Sentry + extra: txMeta, + }) +} + +// +// ethjs-rpc provides overly verbose error messages +// if we detect this type of message, we extract the important part +// Below is an example input and output +// +// Error: [ethjs-rpc] rpc error with payload {"id":3947817945380,"jsonrpc":"2.0","params":["0xf8eb8208708477359400830398539406012c8cf97bead5deae237070f9587f8e7a266d80b8843d7d3f5a0000000000000000000000000000000000000000000000000000000000081d1a000000000000000000000000000000000000000000000000001ff973cafa800000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000003f48025a04c32a9b630e0d9e7ff361562d850c86b7a884908135956a7e4a336fa0300d19ca06830776423f25218e8d19b267161db526e66895567147015b1f3fc47aef9a3c7"],"method":"eth_sendRawTransaction"} Error: replacement transaction underpriced +// +// "Transaction Failed: replacement transaction underpriced" +// + +function extractErrorMessage(errorMessage) { + const isEthjsRpcError = errorMessage.includes(ethJsRpcSlug) + if (isEthjsRpcError) { + const payloadAndError = errorMessage.slice(ethJsRpcSlug.length) + const originalError = payloadAndError.slice(payloadAndError.indexOf(errorLabelPrefix) + errorLabelPrefix.length) + return `Transaction Failed: ${originalError}` + } else { + return `Transaction Failed: ${errorMessage}` + } +} -- cgit v1.2.3 From c3bd27c9657d5e0236e2960dedd108ca5e2bb0ec Mon Sep 17 00:00:00 2001 From: kumavis Date: Wed, 28 Feb 2018 10:57:54 -0800 Subject: sentry - extractErrorMessage - fix comment formatting --- app/scripts/lib/reportFailedTxToSentry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/reportFailedTxToSentry.js b/app/scripts/lib/reportFailedTxToSentry.js index 67b0acf43..ee73f6845 100644 --- a/app/scripts/lib/reportFailedTxToSentry.js +++ b/app/scripts/lib/reportFailedTxToSentry.js @@ -23,7 +23,7 @@ function reportFailedTxToSentry({ raven, txMeta }) { // // Error: [ethjs-rpc] rpc error with payload {"id":3947817945380,"jsonrpc":"2.0","params":["0xf8eb8208708477359400830398539406012c8cf97bead5deae237070f9587f8e7a266d80b8843d7d3f5a0000000000000000000000000000000000000000000000000000000000081d1a000000000000000000000000000000000000000000000000001ff973cafa800000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000003f48025a04c32a9b630e0d9e7ff361562d850c86b7a884908135956a7e4a336fa0300d19ca06830776423f25218e8d19b267161db526e66895567147015b1f3fc47aef9a3c7"],"method":"eth_sendRawTransaction"} Error: replacement transaction underpriced // -// "Transaction Failed: replacement transaction underpriced" +// Transaction Failed: replacement transaction underpriced // function extractErrorMessage(errorMessage) { -- cgit v1.2.3