diff options
Add UI for Signing Messages
Calls to `eth.sign` are now transiently persisted in memory, and displayed in a chronological stack with pending transactions (which are still persisted to disk).
This allows the user a method to sign/cancel transactions even if they miss the Chrome notification.
Improved a lot of the view routing, to avoid cases where routes would show an empty account view, or transition to the accounts list when it shouldn't.
Broke the transaction approval view into a couple components so messages and transactions could have their own templates.
Diffstat (limited to 'app/scripts/lib/config-manager.js')
-rw-r--r-- | app/scripts/lib/config-manager.js | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js index 0e7454dfd..5bfb8befe 100644 --- a/app/scripts/lib/config-manager.js +++ b/app/scripts/lib/config-manager.js @@ -211,73 +211,6 @@ ConfigManager.prototype.updateTx = function(tx) { this._saveTxList(transactions) } -// -// Msg -// - -ConfigManager.prototype.getMsgList = function() { - var data = this.migrator.getData() - if (data.messages !== undefined) { - return data.messages - } else { - return [] - } -} - -ConfigManager.prototype.unconfirmedMsgs = function() { - var messages = this.getMsgList() - return messages.filter(msg => msg.status === 'unconfirmed') - .reduce((result, msg) => { result[msg.id] = msg; return result }, {}) -} - -ConfigManager.prototype._saveMsgList = function(msgList) { - var data = this.migrator.getData() - data.messages = msgList - this.setData(data) -} - -ConfigManager.prototype.addMsg = function(msg) { - var messages = this.getMsgList() - messages.push(msg) - this._saveMsgList(messages) -} - -ConfigManager.prototype.getMsg = function(msgId) { - var messages = this.getMsgList() - var matching = messages.filter(msg => msg.id === msgId) - return matching.length > 0 ? matching[0] : null -} - -ConfigManager.prototype.confirmMsg = function(msgId) { - this._setMsgStatus(msgId, 'confirmed') -} - -ConfigManager.prototype.rejectMsg = function(msgId) { - this._setMsgStatus(msgId, 'rejected') -} - -ConfigManager.prototype._setMsgStatus = function(msgId, status) { - var msg = this.getMsg(msgId) - msg.status = status - this.updateMsg(msg) -} - -ConfigManager.prototype.updateMsg = function(msg) { - var messages = this.getMsgList() - var found, index - messages.forEach((otherMsg, i) => { - if (otherMsg.id === msg.id) { - found = true - index = i - } - }) - if (found) { - messages[index] = msg - } - this._saveMsgList(messages) -} - - // observable |