diff options
author | Francesco Agosti <francesco.agosti93@gmail.com> | 2018-11-03 07:26:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-03 07:26:16 +0800 |
commit | 66261102de57e3bc86714577c021aa5c7e17c150 (patch) | |
tree | 2a146790ba3d0a632a23c7335a3dcbd9d5a8c881 /packages/instant/src/util/assert.ts | |
parent | d0f20a4fd5d1ab563d4b1c941b55018da129334e (diff) | |
parent | 6748c36b033798de4eb56e5d4e49d1c4b4e7be1e (diff) | |
download | dexon-sol-tools-66261102de57e3bc86714577c021aa5c7e17c150.tar dexon-sol-tools-66261102de57e3bc86714577c021aa5c7e17c150.tar.gz dexon-sol-tools-66261102de57e3bc86714577c021aa5c7e17c150.tar.bz2 dexon-sol-tools-66261102de57e3bc86714577c021aa5c7e17c150.tar.lz dexon-sol-tools-66261102de57e3bc86714577c021aa5c7e17c150.tar.xz dexon-sol-tools-66261102de57e3bc86714577c021aa5c7e17c150.tar.zst dexon-sol-tools-66261102de57e3bc86714577c021aa5c7e17c150.zip |
Merge pull request #1204 from 0xProject/feature/instant/maker-asset-datas-interface
[instant] Add `availableAssetDatas` to render method, fetch from asset-buyer if not specified, implement basic token selection
Diffstat (limited to 'packages/instant/src/util/assert.ts')
-rw-r--r-- | packages/instant/src/util/assert.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/packages/instant/src/util/assert.ts b/packages/instant/src/util/assert.ts index 99e177993..971c1eb96 100644 --- a/packages/instant/src/util/assert.ts +++ b/packages/instant/src/util/assert.ts @@ -8,12 +8,15 @@ import { AffiliateInfo, AssetMetaData } from '../types'; export const assert = { ...sharedAssert, - isValidLiquiditySource(variableName: string, liquiditySource: string | SignedOrder[]): void { - if (_.isString(liquiditySource)) { - sharedAssert.isUri(variableName, liquiditySource); + isValidOrderSource(variableName: string, orderSource: string | SignedOrder[]): void { + if (_.isString(orderSource)) { + sharedAssert.isUri(variableName, orderSource); return; } - sharedAssert.doesConformToSchema(variableName, liquiditySource, schemas.signedOrdersSchema); + 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) => { |