diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/instant/src/index.umd.ts | 3 | ||||
-rw-r--r-- | packages/instant/src/util/assert.ts | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/packages/instant/src/index.umd.ts b/packages/instant/src/index.umd.ts index 77bdb66e1..b998abe95 100644 --- a/packages/instant/src/index.umd.ts +++ b/packages/instant/src/index.umd.ts @@ -20,5 +20,8 @@ export const render = (props: ZeroExInstantProps, selector: string = DEFAULT_ZER if (!_.isUndefined(props.networkId)) { assert.isNumber('networkId', props.networkId); } + if (!_.isUndefined(props.availableAssetDatas)) { + assert.areValidAssetDatas('availableAssetDatas', props.availableAssetDatas); + } ReactDOM.render(React.createElement(ZeroExInstant, props), document.querySelector(selector)); }; diff --git a/packages/instant/src/util/assert.ts b/packages/instant/src/util/assert.ts index 1267a1d23..7c07215bf 100644 --- a/packages/instant/src/util/assert.ts +++ b/packages/instant/src/util/assert.ts @@ -15,6 +15,9 @@ export const assert = { } sharedAssert.doesConformToSchema(variableName, orderSource, schemas.signedOrdersSchema); }, + areValidAssetDatas(variableName: string, assetDatas: string[]): void { + _.forEach(assetDatas, (assetData, index) => assert.isHexString(`${variableName}[${index}]`, assetData)); + }, isValidAssetMetaDataMap(variableName: string, metaDataMap: ObjectMap<AssetMetaData>): void { _.forEach(metaDataMap, (metaData, assetData) => { assert.isHexString(`key ${assetData} of ${variableName}`, assetData); |