aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-11 05:36:54 +0800
committerFabio Berger <me@fabioberger.com>2018-03-11 05:36:54 +0800
commitc050186014e4bc060ccbfb3e15ea39d86e59f0c4 (patch)
treeeca17ec3ab4e0dfa0e7ca39c6cd6339a99e1fa51 /packages
parent63f2606863b9dc3b01fbdc52e232103d07f35c45 (diff)
downloaddexon-sol-tools-c050186014e4bc060ccbfb3e15ea39d86e59f0c4.tar
dexon-sol-tools-c050186014e4bc060ccbfb3e15ea39d86e59f0c4.tar.gz
dexon-sol-tools-c050186014e4bc060ccbfb3e15ea39d86e59f0c4.tar.bz2
dexon-sol-tools-c050186014e4bc060ccbfb3e15ea39d86e59f0c4.tar.lz
dexon-sol-tools-c050186014e4bc060ccbfb3e15ea39d86e59f0c4.tar.xz
dexon-sol-tools-c050186014e4bc060ccbfb3e15ea39d86e59f0c4.tar.zst
dexon-sol-tools-c050186014e4bc060ccbfb3e15ea39d86e59f0c4.zip
Use undefined rather then an empty string in blockchainWatcher
Diffstat (limited to 'packages')
-rw-r--r--packages/website/ts/blockchain_watcher.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/website/ts/blockchain_watcher.ts b/packages/website/ts/blockchain_watcher.ts
index af5bafc0c..d3801cef4 100644
--- a/packages/website/ts/blockchain_watcher.ts
+++ b/packages/website/ts/blockchain_watcher.ts
@@ -11,7 +11,7 @@ export class BlockchainWatcher {
private _shouldPollUserAddress: boolean;
private _watchNetworkAndBalanceIntervalId: NodeJS.Timer;
private _prevUserEtherBalanceInWei: BigNumber;
- private _prevUserAddress: string;
+ private _prevUserAddressIfExists: string;
constructor(
dispatcher: Dispatcher,
web3Wrapper: Web3Wrapper,
@@ -33,7 +33,7 @@ export class BlockchainWatcher {
}
// This should only be called from the LedgerConfigDialog
public updatePrevUserAddress(userAddress: string) {
- this._prevUserAddress = userAddress;
+ this._prevUserAddressIfExists = userAddress;
}
public startEmittingNetworkConnectionAndUserBalanceState() {
if (!_.isUndefined(this._watchNetworkAndBalanceIntervalId)) {
@@ -66,22 +66,22 @@ export class BlockchainWatcher {
if (this._shouldPollUserAddress) {
const addresses = await this._web3Wrapper.getAvailableAddressesAsync();
- const userAddressIfExists = addresses[0] || '';
+ const userAddressIfExists = addresses[0];
// Update makerAddress on network change
- if (this._prevUserAddress !== userAddressIfExists) {
- this._prevUserAddress = userAddressIfExists;
+ if (this._prevUserAddressIfExists !== userAddressIfExists) {
+ this._prevUserAddressIfExists = userAddressIfExists;
this._dispatcher.updateUserAddress(userAddressIfExists);
}
// Check for user ether balance changes
- if (!_.isEmpty(userAddressIfExists)) {
+ if (!_.isUndefined(userAddressIfExists)) {
await this._updateUserWeiBalanceAsync(userAddressIfExists);
}
} else {
// This logic is primarily for the Ledger, since we don't regularly poll for the address
// we simply update the balance for the last fetched address.
- if (!_.isEmpty(this._prevUserAddress)) {
- await this._updateUserWeiBalanceAsync(this._prevUserAddress);
+ if (!_.isUndefined(this._prevUserAddressIfExists)) {
+ await this._updateUserWeiBalanceAsync(this._prevUserAddressIfExists);
}
}
},