diff options
author | Leonid <logvinov.leon@gmail.com> | 2018-01-18 22:27:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-18 22:27:01 +0800 |
commit | 9203813a612f835043dcd42302af97ad0372790d (patch) | |
tree | 9beaa00563c4f0a026d4921ddc8d35bbc0278da0 /packages/website/ts/web3_wrapper.ts | |
parent | e5eec04f92b51319dc55c46c9be7b9d6fe5a1e48 (diff) | |
parent | f9c21efc3073fea4578d46a47f5a08214c592e87 (diff) | |
download | dexon-sol-tools-9203813a612f835043dcd42302af97ad0372790d.tar dexon-sol-tools-9203813a612f835043dcd42302af97ad0372790d.tar.gz dexon-sol-tools-9203813a612f835043dcd42302af97ad0372790d.tar.bz2 dexon-sol-tools-9203813a612f835043dcd42302af97ad0372790d.tar.lz dexon-sol-tools-9203813a612f835043dcd42302af97ad0372790d.tar.xz dexon-sol-tools-9203813a612f835043dcd42302af97ad0372790d.tar.zst dexon-sol-tools-9203813a612f835043dcd42302af97ad0372790d.zip |
Merge pull request #325 from 0xProject/fix/portal-bugs
Small Fixes/Additions
Diffstat (limited to 'packages/website/ts/web3_wrapper.ts')
-rw-r--r-- | packages/website/ts/web3_wrapper.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/website/ts/web3_wrapper.ts b/packages/website/ts/web3_wrapper.ts index 6f260dc48..407c62aaa 100644 --- a/packages/website/ts/web3_wrapper.ts +++ b/packages/website/ts/web3_wrapper.ts @@ -1,6 +1,7 @@ import { BigNumber, intervalUtils, promisify } from '@0xproject/utils'; import * as _ from 'lodash'; import { Dispatcher } from 'ts/redux/dispatcher'; +import { utils } from 'ts/utils/utils'; import * as Web3 from 'web3'; export class Web3Wrapper { @@ -135,7 +136,10 @@ export class Web3Wrapper { await this._updateUserEtherBalanceAsync(this._prevUserAddress); } } - }, 5000); + }, 5000, (err: Error) => { + utils.consoleLog(`Watching network and balances failed: ${err}`); + this._stopEmittingNetworkConnectionAndUserBalanceStateAsync(); + }); } private async _updateUserEtherBalanceAsync(userAddress: string) { const balance = await this.getBalanceInEthAsync(userAddress); @@ -145,6 +149,6 @@ export class Web3Wrapper { } } private _stopEmittingNetworkConnectionAndUserBalanceStateAsync() { - clearInterval(this._watchNetworkAndBalanceIntervalId); + intervalUtils.clearAsyncExcludingInterval(this._watchNetworkAndBalanceIntervalId); } } |