diff options
author | Brandon Millman <brandon@0xproject.com> | 2018-06-29 01:47:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-29 01:47:43 +0800 |
commit | 0fcbd02d50bd564a9c888f247a4b0a565d928cc6 (patch) | |
tree | 5212c6e17bf377bbdf3b5dc3053c9a55e58ba044 /packages/website/ts/utils/utils.ts | |
parent | 988a3347582cd812aadeaa0cdaef67389c8d833d (diff) | |
parent | 4969797c2327ba0eb92a9723842ab312b6631008 (diff) | |
download | dexon-sol-tools-0fcbd02d50bd564a9c888f247a4b0a565d928cc6.tar dexon-sol-tools-0fcbd02d50bd564a9c888f247a4b0a565d928cc6.tar.gz dexon-sol-tools-0fcbd02d50bd564a9c888f247a4b0a565d928cc6.tar.bz2 dexon-sol-tools-0fcbd02d50bd564a9c888f247a4b0a565d928cc6.tar.lz dexon-sol-tools-0fcbd02d50bd564a9c888f247a4b0a565d928cc6.tar.xz dexon-sol-tools-0fcbd02d50bd564a9c888f247a4b0a565d928cc6.tar.zst dexon-sol-tools-0fcbd02d50bd564a9c888f247a4b0a565d928cc6.zip |
Merge pull request #762 from 0xProject/feature/website/scroll-to-token
Sort wallet tokens by timestamp added and scroll to newly added token
Diffstat (limited to 'packages/website/ts/utils/utils.ts')
-rw-r--r-- | packages/website/ts/utils/utils.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index ff06d923d..d12ae6a98 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -355,6 +355,11 @@ export const utils = { const token = _.find(tokens, { symbol }); return token; }, + getTrackedTokens(tokenByAddress: TokenByAddress): Token[] { + const allTokens = _.values(tokenByAddress); + const trackedTokens = _.filter(allTokens, t => this.isTokenTracked(t)); + return trackedTokens; + }, getFormattedAmountFromToken(token: Token, tokenState: TokenState): string { return utils.getFormattedAmount(tokenState.balance, token.decimals, token.symbol); }, @@ -381,4 +386,7 @@ export const utils = { return BrowserType.Other; } }, + isTokenTracked(token: Token): boolean { + return !_.isUndefined(token.trackedTimestamp); + }, }; |