aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/metamask-controller.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2017-02-04 06:59:07 +0800
committerkumavis <aaron@kumavis.me>2017-02-04 06:59:07 +0800
commitff87b9dc7aa3a3bd0e6ca75ca76d538c5ecaf44a (patch)
treeb610e2bde98829b43d449437b4b3f88e0186d0f4 /app/scripts/metamask-controller.js
parent77f8995568d64aa2d9acd878b43fdeb1e7c3bafb (diff)
downloadtangerine-wallet-browser-ff87b9dc7aa3a3bd0e6ca75ca76d538c5ecaf44a.tar
tangerine-wallet-browser-ff87b9dc7aa3a3bd0e6ca75ca76d538c5ecaf44a.tar.gz
tangerine-wallet-browser-ff87b9dc7aa3a3bd0e6ca75ca76d538c5ecaf44a.tar.bz2
tangerine-wallet-browser-ff87b9dc7aa3a3bd0e6ca75ca76d538c5ecaf44a.tar.lz
tangerine-wallet-browser-ff87b9dc7aa3a3bd0e6ca75ca76d538c5ecaf44a.tar.xz
tangerine-wallet-browser-ff87b9dc7aa3a3bd0e6ca75ca76d538c5ecaf44a.tar.zst
tangerine-wallet-browser-ff87b9dc7aa3a3bd0e6ca75ca76d538c5ecaf44a.zip
id mgmt - update to latest eth_sign spec
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r--app/scripts/metamask-controller.js32
1 files changed, 16 insertions, 16 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index c0910014f..066e389e2 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -56,7 +56,7 @@ module.exports = class MetamaskController extends EventEmitter {
this.currencyController.scheduleConversionInterval()
// rpc provider
- this.provider = this.initializeProvider(opts)
+ this.provider = this.initializeProvider()
this.provider.on('block', this.logBlock.bind(this))
this.provider.on('error', this.verifyNetwork.bind(this))
@@ -418,7 +418,7 @@ module.exports = class MetamaskController extends EventEmitter {
this.opts.showUnconfirmedMessage()
this.messageManager.once(`${msgId}:finished`, (data) => {
switch (data.status) {
- case 'approved':
+ case 'signed':
return cb(null, data.rawSig)
case 'rejected':
return cb(new Error('MetaMask Message Signature: User denied transaction signature.'))
@@ -430,20 +430,20 @@ module.exports = class MetamaskController extends EventEmitter {
signMessage (msgParams, cb) {
const msgId = msgParams.metamaskId
- // sets the status op the message to 'approved'
- // and removes the metamaskId for signing
- return this.messageManager.approveMessage(msgParams)
- .then((cleanMsgParams) => {
- // signs the message
- return this.keyringController.signMessage(cleanMsgParams)
- })
- .then((rawSig) => {
- // tells the listener that the message has been signed
- // and can be returned to the dapp
- this.messageManager.brodcastMessage(rawSig, msgId, 'approved')
- }).then(() => {
- cb()
- }).catch((err) => cb(err))
+ promiseToCallback(
+ // sets the status op the message to 'approved'
+ // and removes the metamaskId for signing
+ this.messageManager.approveMessage(msgParams)
+ .then((cleanMsgParams) => {
+ // signs the message
+ return this.keyringController.signMessage(cleanMsgParams)
+ })
+ .then((rawSig) => {
+ // tells the listener that the message has been signed
+ // and can be returned to the dapp
+ this.messageManager.setMsgStatusSigned(msgId, rawSig)
+ })
+ )(cb)
}