aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorFrankie <frankie.diamond@gmail.com>2017-01-12 04:17:17 +0800
committerFrankie <frankie.diamond@gmail.com>2017-01-12 04:17:17 +0800
commit0b59dafc344994838b3fbd146c55c73ce0cb76af (patch)
tree7b9dbdb7a1b79f0a5884da24d09b4398eff5e01b /app
parent0fae263a9acb1f4023070b37ee1b91815e34de86 (diff)
parent479da078979f0eaee05b2e25e1bb7113a5a62d6d (diff)
downloadtangerine-wallet-browser-0b59dafc344994838b3fbd146c55c73ce0cb76af.tar
tangerine-wallet-browser-0b59dafc344994838b3fbd146c55c73ce0cb76af.tar.gz
tangerine-wallet-browser-0b59dafc344994838b3fbd146c55c73ce0cb76af.tar.bz2
tangerine-wallet-browser-0b59dafc344994838b3fbd146c55c73ce0cb76af.tar.lz
tangerine-wallet-browser-0b59dafc344994838b3fbd146c55c73ce0cb76af.tar.xz
tangerine-wallet-browser-0b59dafc344994838b3fbd146c55c73ce0cb76af.tar.zst
tangerine-wallet-browser-0b59dafc344994838b3fbd146c55c73ce0cb76af.zip
Merge branch 'dev' into integrateTxManagerUI
Diffstat (limited to 'app')
-rw-r--r--app/scripts/lib/config-manager.js7
-rw-r--r--app/scripts/lib/tx-utils.js17
-rw-r--r--app/scripts/metamask-controller.js23
3 files changed, 11 insertions, 36 deletions
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) => {
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) {
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index ae7aee9e3..c0b9b753c 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 {
@@ -176,6 +177,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) => {
@@ -224,37 +229,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,
}
}