diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2019-01-11 08:13:16 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2019-01-11 08:13:16 +0800 |
commit | 119231451013b37059327a676963a0931d7ed093 (patch) | |
tree | fc21c570cbbd601436c5ef4a1697bfe690458b9f /packages/instant/src | |
parent | 841ad8757cc9ba165f9ae303877da0d4b6ffe8b0 (diff) | |
download | dexon-0x-contracts-119231451013b37059327a676963a0931d7ed093.tar.gz dexon-0x-contracts-119231451013b37059327a676963a0931d7ed093.tar.zst dexon-0x-contracts-119231451013b37059327a676963a0931d7ed093.zip |
Add helper functions and expose to umd object
Diffstat (limited to 'packages/instant/src')
-rw-r--r-- | packages/instant/src/index.umd.ts | 12 |
1 files changed, 12 insertions, 0 deletions
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; |