aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/utils
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-06-29 02:13:19 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-06-29 02:17:30 +0800
commite4188f5d4c38e53bf6966a364da41a3aa164b567 (patch)
treeac24b29f975be088a9d3d391f8a73acc7ad14aba /packages/website/ts/utils
parent360927ec77d5ea50848f4c1b2c66566542a28d1c (diff)
parent0fcbd02d50bd564a9c888f247a4b0a565d928cc6 (diff)
downloaddexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.gz
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.bz2
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.lz
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.xz
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.tar.zst
dexon-sol-tools-e4188f5d4c38e53bf6966a364da41a3aa164b567.zip
Merge branch 'v2-prototype' of https://github.com/0xProject/0x-monorepo into feature/website/support-new-metamask
Diffstat (limited to 'packages/website/ts/utils')
-rw-r--r--packages/website/ts/utils/configs.ts2
-rw-r--r--packages/website/ts/utils/constants.ts3
-rw-r--r--packages/website/ts/utils/utils.ts21
3 files changed, 25 insertions, 1 deletions
diff --git a/packages/website/ts/utils/configs.ts b/packages/website/ts/utils/configs.ts
index 4cb60a4ef..2f89f8ccb 100644
--- a/packages/website/ts/utils/configs.ts
+++ b/packages/website/ts/utils/configs.ts
@@ -65,7 +65,7 @@ export const configs = {
} as { [symbol: string]: string },
GOOGLE_ANALYTICS_ID: 'UA-98720122-1',
LAST_LOCAL_STORAGE_FILL_CLEARANCE_DATE: '2017-11-22',
- LAST_LOCAL_STORAGE_TRACKED_TOKEN_CLEARANCE_DATE: '2017-12-19',
+ LAST_LOCAL_STORAGE_TRACKED_TOKEN_CLEARANCE_DATE: '2018-6-25',
OUTDATED_WRAPPED_ETHERS: [
{
42: {
diff --git a/packages/website/ts/utils/constants.ts b/packages/website/ts/utils/constants.ts
index 25670ef27..a3f8eacb0 100644
--- a/packages/website/ts/utils/constants.ts
+++ b/packages/website/ts/utils/constants.ts
@@ -70,6 +70,9 @@ export const constants = {
URL_GITHUB_ORG: 'https://github.com/0xProject',
URL_GITHUB_WIKI: 'https://github.com/0xProject/wiki',
URL_METAMASK_CHROME_STORE: 'https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn',
+ URL_METAMASK_FIREFOX_STORE: 'https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/',
+ URL_METAMASK_HOMEPAGE: 'https://metamask.io/',
+ URL_METAMASK_OPERA_STORE: 'https://addons.opera.com/en/extensions/details/metamask/',
URL_MIST_DOWNLOAD: 'https://github.com/ethereum/mist/releases',
URL_PARITY_CHROME_STORE:
'https://chrome.google.com/webstore/detail/parity-ethereum-integrati/himekenlppkgeaoeddcliojfddemadig',
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index 0cb965f05..d12ae6a98 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -4,11 +4,13 @@ import { constants as sharedConstants, Networks } from '@0xproject/react-shared'
import { ECSignature, Provider } from '@0xproject/types';
import { BigNumber } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
+import * as bowser from 'bowser';
import deepEqual = require('deep-equal');
import * as _ from 'lodash';
import * as moment from 'moment';
import {
BlockchainCallErrs,
+ BrowserType,
Environments,
Order,
Providers,
@@ -353,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);
},
@@ -368,4 +375,18 @@ export const utils = {
isMobile(screenWidth: ScreenWidths): boolean {
return screenWidth === ScreenWidths.Sm;
},
+ getBrowserType(): BrowserType {
+ if (bowser.chrome) {
+ return BrowserType.Chrome;
+ } else if (bowser.firefox) {
+ return BrowserType.Firefox;
+ } else if (bowser.opera) {
+ return BrowserType.Opera;
+ } else {
+ return BrowserType.Other;
+ }
+ },
+ isTokenTracked(token: Token): boolean {
+ return !_.isUndefined(token.trackedTimestamp);
+ },
};