aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/utils/utils.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-06-07 02:47:11 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-06-07 02:47:11 +0800
commit612cc96e417c1397e1874be22208864f12acbda3 (patch)
tree15b4a008804cb691fec0ee2f179332ee7e10a57e /packages/website/ts/utils/utils.ts
parent3898b8e8ab083689221e39de6b18fe31e6699d38 (diff)
downloaddexon-sol-tools-612cc96e417c1397e1874be22208864f12acbda3.tar
dexon-sol-tools-612cc96e417c1397e1874be22208864f12acbda3.tar.gz
dexon-sol-tools-612cc96e417c1397e1874be22208864f12acbda3.tar.bz2
dexon-sol-tools-612cc96e417c1397e1874be22208864f12acbda3.tar.lz
dexon-sol-tools-612cc96e417c1397e1874be22208864f12acbda3.tar.xz
dexon-sol-tools-612cc96e417c1397e1874be22208864f12acbda3.tar.zst
dexon-sol-tools-612cc96e417c1397e1874be22208864f12acbda3.zip
Add utilities for getting tokens from tokensByAddress
Diffstat (limited to 'packages/website/ts/utils/utils.ts')
-rw-r--r--packages/website/ts/utils/utils.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index b9d962b75..9c564ebc5 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -21,6 +21,7 @@ import {
import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
import * as u2f from 'ts/vendor/u2f_api';
+import { Container } from '../components/ui/container';
const LG_MIN_EM = 64;
const MD_MIN_EM = 52;
@@ -322,8 +323,14 @@ export const utils = {
return this.isDevelopment() || this.isStaging() || this.isDogfood();
},
getEthToken(tokenByAddress: TokenByAddress): Token {
+ return utils.getTokenBySymbol(constants.ETHER_TOKEN_SYMBOL, tokenByAddress);
+ },
+ getZrxToken(tokenByAddress: TokenByAddress): Token {
+ return utils.getTokenBySymbol(constants.ZRX_TOKEN_SYMBOL, tokenByAddress);
+ },
+ getTokenBySymbol(symbol: string, tokenByAddress: TokenByAddress): Token {
const tokens = _.values(tokenByAddress);
- const etherToken = _.find(tokens, { symbol: constants.ETHER_TOKEN_SYMBOL });
- return etherToken;
+ const token = _.find(tokens, { symbol });
+ return token;
},
};