aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/blockchain.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-11 19:04:46 +0800
committerFabio Berger <me@fabioberger.com>2018-03-11 19:04:46 +0800
commit56a8e0a09a61ca2c399c676da695bf4cd4ed63a6 (patch)
tree0b2bb05f7101f6e27305dd8170f703e247cd8400 /packages/website/ts/blockchain.ts
parent4c08667a078ac9ca1ed5dc62d87a8cfe3b903741 (diff)
downloaddexon-sol-tools-56a8e0a09a61ca2c399c676da695bf4cd4ed63a6.tar
dexon-sol-tools-56a8e0a09a61ca2c399c676da695bf4cd4ed63a6.tar.gz
dexon-sol-tools-56a8e0a09a61ca2c399c676da695bf4cd4ed63a6.tar.bz2
dexon-sol-tools-56a8e0a09a61ca2c399c676da695bf4cd4ed63a6.tar.lz
dexon-sol-tools-56a8e0a09a61ca2c399c676da695bf4cd4ed63a6.tar.xz
dexon-sol-tools-56a8e0a09a61ca2c399c676da695bf4cd4ed63a6.tar.zst
dexon-sol-tools-56a8e0a09a61ca2c399c676da695bf4cd4ed63a6.zip
Fix userAddress bugs
Diffstat (limited to 'packages/website/ts/blockchain.ts')
-rw-r--r--packages/website/ts/blockchain.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index 0cb36230b..3e19cb715 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -531,16 +531,14 @@ export class Blockchain {
!_.isUndefined(this.networkId),
'Cannot call fetchTokenInformationAsync if disconnected from Ethereum node',
);
- utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
this._dispatcher.updateBlockchainIsLoaded(false);
const tokenRegistryTokensByAddress = await this._getTokenRegistryTokensByAddressAsync();
- const trackedTokensByAddress = trackedTokenStorage.getTrackedTokensByAddress(
- this._userAddressIfExists,
- this.networkId,
- );
+ const trackedTokensByAddress = _.isUndefined(this._userAddressIfExists)
+ ? {}
+ : trackedTokenStorage.getTrackedTokensByAddress(this._userAddressIfExists, this.networkId);
const tokenRegistryTokens = _.values(tokenRegistryTokensByAddress);
if (_.isEmpty(trackedTokensByAddress)) {
_.each(configs.DEFAULT_TRACKED_TOKEN_SYMBOLS, symbol => {
@@ -548,9 +546,11 @@ export class Blockchain {
token.isTracked = true;
trackedTokensByAddress[token.address] = token;
});
- _.each(trackedTokensByAddress, (token: Token, address: string) => {
- trackedTokenStorage.addTrackedTokenToUser(this._userAddressIfExists, this.networkId, token);
- });
+ if (!_.isUndefined(this._userAddressIfExists)) {
+ _.each(trackedTokensByAddress, (token: Token, address: string) => {
+ trackedTokenStorage.addTrackedTokenToUser(this._userAddressIfExists, this.networkId, token);
+ });
+ }
} else {
// Properly set all tokenRegistry tokens `isTracked` to true if they are in the existing trackedTokens array
_.each(trackedTokensByAddress, (trackedToken: Token, address: string) => {