From 119231451013b37059327a676963a0931d7ed093 Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Thu, 10 Jan 2019 16:13:16 -0800 Subject: Add helper functions and expose to umd object --- packages/instant/src/index.umd.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/instant/src/index.umd.ts b/packages/instant/src/index.umd.ts index d172f4145..5a1eb1608 100644 --- a/packages/instant/src/index.umd.ts +++ b/packages/instant/src/index.umd.ts @@ -1,3 +1,4 @@ +import { assetDataUtils } from '@0x/order-utils'; import * as _ from 'lodash'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; @@ -9,6 +10,7 @@ import { INJECTED_DIV_ID, NPM_PACKAGE_VERSION, } from './constants'; +import { assetMetaDataMap } from './data/asset_meta_data_map'; import { ZeroExInstantOverlay, ZeroExInstantOverlayProps } from './index'; import { analytics } from './util/analytics'; import { assert } from './util/assert'; @@ -122,6 +124,16 @@ export const render = (config: ZeroExInstantConfig, selector: string = DEFAULT_Z window.onpopstate = onPopStateHandler; }; +export const assetDataForERC20TokenAddress = (tokenAddress: string): string => { + assert.isETHAddressHex('tokenAddress', tokenAddress); + return assetDataUtils.encodeERC20AssetData(tokenAddress); +}; + +export const hasMetaDataForAssetData = (assetData: string): boolean => { + assert.isHexString('assetData', assetData); + return assetMetaDataMap[assetData] !== undefined; +}; + // Write version info to the exported object for debugging export const GIT_SHA = GIT_SHA_FROM_CONSTANT; export const NPM_VERSION = NPM_PACKAGE_VERSION; -- cgit v1.2.3