diff options
Diffstat (limited to 'app/scripts/metamask-controller.js')
-rw-r--r-- | app/scripts/metamask-controller.js | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index a165a2e2a..951918460 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -17,6 +17,7 @@ module.exports = class MetamaskController { this.configManager = new ConfigManager(opts) this.keyringController = new KeyringController({ configManager: this.configManager, + getNetwork: this.getStateNetwork.bind(this), }) this.provider = this.initializeProvider(opts) this.ethStore = new EthStore(this.provider) @@ -86,23 +87,6 @@ module.exports = class MetamaskController { } onRpcRequest (stream, originDomain, request) { - - /* Commented out for Parity compliance - * Parity does not permit additional keys, like `origin`, - * and Infura is not currently filtering this key out. - var payloads = Array.isArray(request) ? request : [request] - payloads.forEach(function (payload) { - // Append origin to rpc payload - payload.origin = originDomain - // Append origin to signature request - if (payload.method === 'eth_sendTransaction') { - payload.params[0].origin = originDomain - } else if (payload.method === 'eth_sign') { - payload.params.push({ origin: originDomain }) - } - }) - */ - // handle rpc request this.provider.sendAsync(request, function onPayloadHandled (err, response) { logger(err, request, response) @@ -215,10 +199,8 @@ module.exports = class MetamaskController { newUnsignedTransaction (txParams, onTxDoneCb) { const keyringController = this.keyringController - - let err = this.enforceTxValidations(txParams) + const err = this.enforceTxValidations(txParams) if (err) return onTxDoneCb(err) - keyringController.addUnconfirmedTransaction(txParams, onTxDoneCb, (err, txData) => { if (err) return onTxDoneCb(err) this.sendUpdate() @@ -291,12 +273,11 @@ module.exports = class MetamaskController { } catch (e) { console.error('Error in checking TOS change.') } - } agreeToDisclaimer (cb) { try { - this.configManager.setConfirmed(true) + this.configManager.setConfirmedDisclaimer(true) cb() } catch (e) { cb(e) @@ -305,7 +286,7 @@ module.exports = class MetamaskController { resetDisclaimer () { try { - this.configManager.setConfirmed(false) + this.configManager.setConfirmedDisclaimer(false) } catch (e) { console.error(e) } @@ -373,7 +354,7 @@ module.exports = class MetamaskController { this.configManager.createShapeShiftTx(depositAddress, depositType) } - getNetwork(err) { + getNetwork (err) { if (err) { this.state.network = 'loading' this.sendUpdate() @@ -400,4 +381,8 @@ module.exports = class MetamaskController { cb(e) } } + + getStateNetwork () { + return this.state.network + } } |