diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-11 19:04:46 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-11 19:04:46 +0800 |
commit | 56a8e0a09a61ca2c399c676da695bf4cd4ed63a6 (patch) | |
tree | 0b2bb05f7101f6e27305dd8170f703e247cd8400 /packages/website/ts/blockchain.ts | |
parent | 4c08667a078ac9ca1ed5dc62d87a8cfe3b903741 (diff) | |
download | dexon-sol-tools-56a8e0a09a61ca2c399c676da695bf4cd4ed63a6.tar.gz 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.ts | 16 |
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) => { |