From b301c0fb48f8a6ba464c7ed48d009166ea1fc230 Mon Sep 17 00:00:00 2001 From: kumavis Date: Tue, 10 Jan 2017 12:04:26 -0800 Subject: deps - replace promise-request with fetch --- app/scripts/lib/config-manager.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/scripts/lib/config-manager.js b/app/scripts/lib/config-manager.js index 93501c859..3a1f12ac0 100644 --- a/app/scripts/lib/config-manager.js +++ b/app/scripts/lib/config-manager.js @@ -1,7 +1,6 @@ const Migrator = require('pojo-migrator') const MetamaskConfig = require('../config.js') const migrations = require('./migrations') -const rp = require('request-promise') const ethUtil = require('ethereumjs-util') const normalize = require('./sig-util').normalize @@ -301,9 +300,9 @@ ConfigManager.prototype.getCurrentFiat = function () { ConfigManager.prototype.updateConversionRate = function () { var data = this.getData() - return rp(`https://www.cryptonator.com/api/ticker/eth-${data.fiatCurrency}`) - .then((response) => { - const parsedResponse = JSON.parse(response) + return fetch(`https://www.cryptonator.com/api/ticker/eth-${data.fiatCurrency}`) + .then(response => response.json()) + .then((parsedResponse) => { this.setConversionPrice(parsedResponse.ticker.price) this.setConversionDate(parsedResponse.timestamp) }).catch((err) => { -- cgit v1.2.3 From 21e2e4efd803c8c904cecf039ee73fead0e6c4c1 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 10 Jan 2017 14:20:46 -0800 Subject: Remove erroneous OOG estimation logic. --- app/scripts/lib/tx-utils.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'app') diff --git a/app/scripts/lib/tx-utils.js b/app/scripts/lib/tx-utils.js index a976173f5..d1fb98f42 100644 --- a/app/scripts/lib/tx-utils.js +++ b/app/scripts/lib/tx-utils.js @@ -20,7 +20,6 @@ module.exports = class txProviderUtils { if (err) return cb(err) async.waterfall([ self.estimateTxGas.bind(self, txData, block.gasLimit), - self.checkForTxGasError.bind(self, txData), self.setTxGas.bind(self, txData, block.gasLimit), ], cb) }) @@ -38,22 +37,10 @@ module.exports = class txProviderUtils { this.query.estimateGas(txParams, cb) } - checkForTxGasError (txData, estimatedGasHex, cb) { + setTxGas (txData, blockGasLimitHex, estimatedGasHex, cb) { txData.estimatedGas = estimatedGasHex - // all gas used - must be an error - if (estimatedGasHex === txData.txParams.gas) { - txData.simulationFails = true - } - cb() - } - - setTxGas (txData, blockGasLimitHex, cb) { const txParams = txData.txParams - // if OOG, nothing more to do - if (txData.simulationFails) { - cb() - return - } + // if gasLimit was specified and doesnt OOG, // use original specified amount if (txData.gasLimitSpecified) { -- cgit v1.2.3 From 61637c738bf0e1625b1b6f69ef3747c60d564304 Mon Sep 17 00:00:00 2001 From: kumavis Date: Wed, 11 Jan 2017 00:46:44 -0800 Subject: web3 provider - override eth_syncing and web3_clientVersion --- app/scripts/metamask-controller.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app') diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 555460f3d..d79fd3cd3 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -13,6 +13,7 @@ const extension = require('./lib/extension') const autoFaucet = require('./lib/auto-faucet') const nodeify = require('./lib/nodeify') const IdStoreMigrator = require('./lib/idStore-migrator') +const version = require('../manifest.json').version module.exports = class MetamaskController extends EventEmitter { @@ -175,6 +176,10 @@ module.exports = class MetamaskController extends EventEmitter { const keyringController = this.keyringController var providerOpts = { + static: { + eth_syncing: false, + web3_clientVersion: `MetaMask/v${version}`, + }, rpcUrl: this.configManager.getCurrentRpcAddress(), // account mgmt getAccounts: (cb) => { -- cgit v1.2.3 From 26e4ff40e15c74d5fc2613d33686d480f6eed25a Mon Sep 17 00:00:00 2001 From: kumavis Date: Wed, 11 Jan 2017 02:33:57 -0800 Subject: rpc - fix sync account cache setting --- app/scripts/metamask-controller.js | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'app') diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index d79fd3cd3..1fc97e81d 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -228,37 +228,21 @@ module.exports = class MetamaskController extends EventEmitter { initPublicConfigStore () { // get init state - var initPublicState = extend( - keyringControllerToPublic(this.keyringController.getState()), - configToPublic(this.configManager.getConfig()) - ) - + var initPublicState = configToPublic(this.configManager.getConfig()) var publicConfigStore = new HostStore(initPublicState) // subscribe to changes this.configManager.subscribe(function (state) { storeSetFromObj(publicConfigStore, configToPublic(state)) }) - this.keyringController.on('update', () => { - const state = this.keyringController.getState() - storeSetFromObj(publicConfigStore, keyringControllerToPublic(state)) - this.sendUpdate() - }) this.keyringController.on('newAccount', (account) => { autoFaucet(account) }) - // keyringController substate - function keyringControllerToPublic (state) { - return { - selectedAccount: state.selectedAccount, - } - } // config substate function configToPublic (state) { return { - provider: state.provider, selectedAccount: state.selectedAccount, } } -- cgit v1.2.3