aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util/asset_data.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-10-18 18:35:07 +0800
committerFabio Berger <me@fabioberger.com>2018-10-18 18:35:07 +0800
commitcdd650d0eb83153a992922c6ffff35b494f299d3 (patch)
treefc12135e69ae74403a26408d2d7625e8a3fe334e /packages/instant/src/util/asset_data.ts
parentc333d093b585fa0250a6973f2d396eb3cf227334 (diff)
parentbd8ba14bf46cb901e14f0ee718ac01cdbc833e86 (diff)
downloaddexon-sol-tools-cdd650d0eb83153a992922c6ffff35b494f299d3.tar
dexon-sol-tools-cdd650d0eb83153a992922c6ffff35b494f299d3.tar.gz
dexon-sol-tools-cdd650d0eb83153a992922c6ffff35b494f299d3.tar.bz2
dexon-sol-tools-cdd650d0eb83153a992922c6ffff35b494f299d3.tar.lz
dexon-sol-tools-cdd650d0eb83153a992922c6ffff35b494f299d3.tar.xz
dexon-sol-tools-cdd650d0eb83153a992922c6ffff35b494f299d3.tar.zst
dexon-sol-tools-cdd650d0eb83153a992922c6ffff35b494f299d3.zip
merge development
Diffstat (limited to 'packages/instant/src/util/asset_data.ts')
-rw-r--r--packages/instant/src/util/asset_data.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/packages/instant/src/util/asset_data.ts b/packages/instant/src/util/asset_data.ts
new file mode 100644
index 000000000..f7c5b78cd
--- /dev/null
+++ b/packages/instant/src/util/asset_data.ts
@@ -0,0 +1,21 @@
+import * as _ from 'lodash';
+
+import { AssetProxyId } from '@0xproject/types';
+
+import { assetMetaData } from '../data/asset_meta_data';
+
+export const assetDataUtil = {
+ bestNameForAsset: (assetData: string | undefined, defaultString: string) => {
+ if (_.isUndefined(assetData)) {
+ return defaultString;
+ }
+ const metaData = assetMetaData[assetData];
+ if (_.isUndefined(metaData)) {
+ return defaultString;
+ }
+ if (metaData.assetProxyId === AssetProxyId.ERC20) {
+ return metaData.symbol.toUpperCase();
+ }
+ return defaultString;
+ },
+};