diff options
notifications - add tx confirm+cancel buttons
Diffstat (limited to 'app/scripts/background.js')
-rw-r--r-- | app/scripts/background.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js index 4567dc656..a724a87e8 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -8,6 +8,7 @@ const EthStore = require('eth-store') const PortStream = require('./lib/port-stream.js') const MetaMaskProvider = require('web3-provider-engine/zero.js') const IdentityStore = require('./lib/idStore') +const createTxNotification = require('./lib/tx-notification.js') console.log('ready to roll') @@ -159,13 +160,13 @@ function updateBadge(state){ // function addUnconfirmedTx(txParams, cb){ - chrome.notifications.create({ - type: 'basic', - iconUrl: '/images/icon-128.png', - title: 'New Transaction', - message: 'click the extension to confirm...', + var txId = idStore.addUnconfirmedTransaction(txParams, cb) + createTxNotification({ + title: 'New Unsigned Transaction', + txParams: txParams, + confirm: idStore.approveTransaction.bind(idStore, txId, noop), + cancel: idStore.cancelTransaction.bind(idStore, txId), }) - idStore.addUnconfirmedTransaction(txParams, cb) } // @@ -204,4 +205,6 @@ function jsonStringifyStream(){ this.push(JSON.stringify(obj)) cb() }) -}
\ No newline at end of file +} + +function noop(){}
\ No newline at end of file |