aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorKevin Serrano <kevin.serrano@consensys.net>2017-03-25 05:13:57 +0800
committerKevin Serrano <kevin.serrano@consensys.net>2017-03-25 05:13:57 +0800
commit30e8d250138bef588d25619b9fc9563dbbb8ecac (patch)
tree563330742d202a9aa8fccc2b7234c6e259f8ea90 /app
parent2e446eb5880396716d919e10e97a7ab824cc0fc1 (diff)
parentfb39539214ca888300eb192e0e137a512cc0d88a (diff)
downloadtangerine-wallet-browser-30e8d250138bef588d25619b9fc9563dbbb8ecac.tar
tangerine-wallet-browser-30e8d250138bef588d25619b9fc9563dbbb8ecac.tar.gz
tangerine-wallet-browser-30e8d250138bef588d25619b9fc9563dbbb8ecac.tar.bz2
tangerine-wallet-browser-30e8d250138bef588d25619b9fc9563dbbb8ecac.tar.lz
tangerine-wallet-browser-30e8d250138bef588d25619b9fc9563dbbb8ecac.tar.xz
tangerine-wallet-browser-30e8d250138bef588d25619b9fc9563dbbb8ecac.tar.zst
tangerine-wallet-browser-30e8d250138bef588d25619b9fc9563dbbb8ecac.zip
Merge branch 'master' into i1210-txdisappearance
Diffstat (limited to 'app')
-rw-r--r--app/scripts/lib/tx-utils.js6
-rw-r--r--app/scripts/migrations/012.js36
-rw-r--r--app/scripts/notice-controller.js1
3 files changed, 40 insertions, 3 deletions
diff --git a/app/scripts/lib/tx-utils.js b/app/scripts/lib/tx-utils.js
index c6814c05f..7988f83e9 100644
--- a/app/scripts/lib/tx-utils.js
+++ b/app/scripts/lib/tx-utils.js
@@ -63,7 +63,7 @@ module.exports = class txProviderUtils {
const initialGasLimitBn = hexToBn(initialGasLimitHex)
const blockGasLimitBn = hexToBn(blockGasLimitHex)
const bufferedGasLimitBn = initialGasLimitBn.muln(1.5)
-
+
// if initialGasLimit is above blockGasLimit, dont modify it
if (initialGasLimitBn.gt(blockGasLimitBn)) return bnToHex(initialGasLimitBn)
// if bufferedGasLimit is below blockGasLimit, use bufferedGasLimit
@@ -99,7 +99,7 @@ module.exports = class txProviderUtils {
txParams.from = normalize(txParams.from)
txParams.value = normalize(txParams.value)
txParams.data = normalize(txParams.data)
- txParams.gasLimit = normalize(txParams.gasLimit || txParams.gas)
+ txParams.gas = normalize(txParams.gas || txParams.gasLimit)
txParams.nonce = normalize(txParams.nonce)
// build ethTx
log.info(`Prepared tx for signing: ${JSON.stringify(txParams)}`)
@@ -134,4 +134,4 @@ function bnToHex(inputBn) {
function hexToBn(inputHex) {
return new BN(ethUtil.stripHexPrefix(inputHex), 16)
-} \ No newline at end of file
+}
diff --git a/app/scripts/migrations/012.js b/app/scripts/migrations/012.js
new file mode 100644
index 000000000..8361b3793
--- /dev/null
+++ b/app/scripts/migrations/012.js
@@ -0,0 +1,36 @@
+const version = 12
+
+/*
+
+This migration modifies our notices to delete their body after being read.
+
+*/
+
+const clone = require('clone')
+
+module.exports = {
+ version,
+
+ migrate: function (originalVersionedData) {
+ let 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.NoticeController.noticesList.forEach((notice) => {
+ if (notice.read) {
+ notice.body = ''
+ }
+ })
+ return newState
+}
diff --git a/app/scripts/notice-controller.js b/app/scripts/notice-controller.js
index 0d72760fe..57aad40c5 100644
--- a/app/scripts/notice-controller.js
+++ b/app/scripts/notice-controller.js
@@ -41,6 +41,7 @@ module.exports = class NoticeController extends EventEmitter {
var notices = this.getNoticesList()
var index = notices.findIndex((currentNotice) => currentNotice.id === noticeToMark.id)
notices[index].read = true
+ notices[index].body = ''
this.setNoticesList(notices)
const latestNotice = this.getLatestUnreadNotice()
cb(null, latestNotice)