diff options
author | Hsuan Lee <hsuan@cobinhood.com> | 2018-11-15 00:21:37 +0800 |
---|---|---|
committer | Hsuan Lee <hsuan@cobinhood.com> | 2018-12-10 18:52:22 +0800 |
commit | bb10e7d9a44b4c0d5cc561475b85d6c100388267 (patch) | |
tree | 8da00a51db16571d92cc2fdd04e00566859ee7ef | |
parent | 9819dbe5463a4216d42cb649e215998e80190138 (diff) | |
download | dexon-wallet-bb10e7d9a44b4c0d5cc561475b85d6c100388267.tar.gz dexon-wallet-bb10e7d9a44b4c0d5cc561475b85d6c100388267.tar.zst dexon-wallet-bb10e7d9a44b4c0d5cc561475b85d6c100388267.zip |
Add tracking and improve for network update
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | app/manifest.json | 2 | ||||
-rw-r--r-- | app/scripts/background.js | 1 | ||||
-rw-r--r-- | app/scripts/lib/setupSentry.js | 4 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 10 | ||||
-rw-r--r-- | test/unit/app/controllers/metamask-controller-test.js | 20 | ||||
-rw-r--r-- | test/unit/migrations/migrations-test.js | 5 | ||||
-rw-r--r-- | ui/app/actions.js | 38 | ||||
-rw-r--r-- | ui/app/app.js | 4 |
9 files changed, 57 insertions, 29 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b3b3b3a9..ef92a5a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1205,6 +1205,8 @@ Made seed word restoring BIP44 compatible. Added the ability to restore accounts from seed words. ## Current Master +## 1.0.11 Thu Nov 15 2018 + ## 1.0.10 Tue Nov 13 2018 ## 1.0.9 Mon Nov 12 2018 diff --git a/app/manifest.json b/app/manifest.json index 4ebdd356..48c43c3d 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,7 +1,7 @@ { "name": "__MSG_appName__", "short_name": "__MSG_appName__", - "version": "1.0.10", + "version": "1.0.11", "manifest_version": 2, "author": "https://dexon.org", "description": "__MSG_appDescription__", diff --git a/app/scripts/background.js b/app/scripts/background.js index 601dfc06..01ec0d8b 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -144,7 +144,6 @@ setupMetamaskMeshMetrics() * @property {number} conversionDate - A unix epoch date (ms) for the time the current conversion rate was last retrieved. * @property {Object} infuraNetworkStatus - An object of infura network status checks. * @property {Block[]} recentBlocks - An array of recent blocks, used to calculate an effective but cheap gas price. - * @property {Array} shapeShiftTxList - An array of objects describing shapeshift exchange attempts. * @property {Array} lostAccounts - TODO: Remove this feature. A leftover from the version-3 migration where our seed-phrase library changed to fix a bug where some accounts were mis-generated, but we recovered the old accounts as "lost" instead of losing them. * @property {boolean} forgottenPassword - Returns true if the user has initiated the password recovery screen, is recovering from seed phrase. */ diff --git a/app/scripts/lib/setupSentry.js b/app/scripts/lib/setupSentry.js index ba0e17df..8471f907 100644 --- a/app/scripts/lib/setupSentry.js +++ b/app/scripts/lib/setupSentry.js @@ -1,8 +1,8 @@ const Sentry = require('@sentry/browser') const METAMASK_DEBUG = process.env.METAMASK_DEBUG const extractEthjsErrorMessage = require('./extractEthjsErrorMessage') -const SENTRY_DSN_PROD = 'https://3567c198f8a8412082d32655da2961d0@sentry.io/273505' -const SENTRY_DSN_DEV = 'https://f59f3dd640d2429d9d0e2445a87ea8e1@sentry.io/273496' +const SENTRY_DSN_PROD = 'https://4420aa8c15c04929ad00ed184f6e4b65@sentry.io/1323015' +const SENTRY_DSN_DEV = 'https://4420aa8c15c04929ad00ed184f6e4b65@sentry.io/1323015' module.exports = setupSentry diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 20ca6e45..963ffefa 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -398,6 +398,8 @@ module.exports = class MetamaskController extends EventEmitter { placeSeedWords: this.placeSeedWords.bind(this), verifySeedPhrase: nodeify(this.verifySeedPhrase, this), clearSeedWordCache: this.clearSeedWordCache.bind(this), + resetNetwork: nodeify(this.resetNetwork, this), + updateAllBalances: nodeify(this.updateAllBalances, this), resetAccount: nodeify(this.resetAccount, this), removeAccount: nodeify(this.removeAccount, this), importAccountWithStrategy: nodeify(this.importAccountWithStrategy, this), @@ -556,6 +558,10 @@ module.exports = class MetamaskController extends EventEmitter { } } + async updateAllBalances () { + await this.balancesController.updateAllBalances() + } + /** * Get an account balance from the AccountTracker or request it directly from the network. * @param {string} address - The account address @@ -824,6 +830,10 @@ module.exports = class MetamaskController extends EventEmitter { cb(null, this.preferencesController.getSelectedAddress()) } + async resetNetwork () { + this.networkController.resetConnection() + } + /** * Clears the transaction history, to allow users to force-reset their nonces. * Mostly used in development environments, when networks are restarted with diff --git a/test/unit/app/controllers/metamask-controller-test.js b/test/unit/app/controllers/metamask-controller-test.js index 349c0127..976ffb84 100644 --- a/test/unit/app/controllers/metamask-controller-test.js +++ b/test/unit/app/controllers/metamask-controller-test.js @@ -454,26 +454,6 @@ describe('DekuSanController', function () { }) }) - describe('#createShapeshifttx', function () { - let depositAddress, depositType, shapeShiftTxList - - beforeEach(function () { - nock('https://shapeshift.io') - .get('/txStat/3EevLFfB4H4XMWQwYCgjLie1qCAGpd2WBc') - .reply(200, '{"status": "no_deposits", "address": "3EevLFfB4H4XMWQwYCgjLie1qCAGpd2WBc"}') - - depositAddress = '3EevLFfB4H4XMWQwYCgjLie1qCAGpd2WBc' - depositType = 'ETH' - shapeShiftTxList = metamaskController.shapeshiftController.store.getState().shapeShiftTxList - }) - - it('creates a shapeshift tx', async function () { - metamaskController.createShapeShiftTx(depositAddress, depositType) - assert.equal(shapeShiftTxList[0].depositAddress, depositAddress) - }) - - }) - describe('#addNewAccount', function () { let addNewAccount diff --git a/test/unit/migrations/migrations-test.js b/test/unit/migrations/migrations-test.js index 29725622..8e005cc8 100644 --- a/test/unit/migrations/migrations-test.js +++ b/test/unit/migrations/migrations-test.js @@ -85,11 +85,6 @@ describe('wallet1 is migrated successfully', () => { vault9 = ninthResult return migration10.migrate(ninthResult) - }).then((tenthResult) => { - assert.equal(tenthResult.data.shapeShiftTxList, null, 'old shapeShiftTxList should not exist') - assert.equal(tenthResult.data.ShapeShiftController.shapeShiftTxList[0].transaction, vault9.data.shapeShiftTxList[0].transaction) - - return migration11.migrate(tenthResult) }).then((eleventhResult) => { assert.equal(eleventhResult.data.isDisclaimerConfirmed, null, 'isDisclaimerConfirmed should not exist') assert.equal(eleventhResult.data.TOSHash, null, 'TOSHash should not exist') diff --git a/ui/app/actions.js b/ui/app/actions.js index 240c5b09..cc5ded7f 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -94,6 +94,8 @@ var actions = { unlockHardwareWalletAccount, NEW_ACCOUNT_SCREEN: 'NEW_ACCOUNT_SCREEN', navigateToNewAccountScreen, + resetNetwork, + updateAllBalances, resetAccount, removeAccount, showNewVaultSeed: showNewVaultSeed, @@ -559,6 +561,42 @@ function requestRevealSeedWords (password) { } } +function resetNetwork () { + return dispatch => { + dispatch(actions.showLoadingIndication()) + + return new Promise((resolve, reject) => { + background.resetNetwork((err) => { + dispatch(actions.hideLoadingIndication()) + if (err) { + dispatch(actions.displayWarning(err.message)) + return reject(err) + } + + log.info('Network reset') + }) + }) + } +} + +function updateAllBalances () { + return dispatch => { + dispatch(actions.showLoadingIndication()) + + return new Promise((resolve, reject) => { + background.updateAllBalances((err) => { + dispatch(actions.hideLoadingIndication()) + if (err) { + dispatch(actions.displayWarning(err.message)) + return reject(err) + } + + log.info('All balances updated') + }) + }) + } +} + function resetAccount () { return dispatch => { dispatch(actions.showLoadingIndication()) diff --git a/ui/app/app.js b/ui/app/app.js index 2df4c2ac..9ef292a8 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -64,6 +64,10 @@ const { class App extends Component { componentWillMount () { + // TEMP: hard reset network everytime app launches + this.props.dispatch(actions.resetNetwork()) + this.props.dispatch(actions.updateAllBalances()) + const { currentCurrency, setCurrentCurrencyToUSD } = this.props if (!currentCurrency) { |