diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-11-03 05:38:18 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-11-03 05:38:18 +0800 |
commit | d5521ea5e09f5a42471335b856989751b90184dc (patch) | |
tree | c612141ef0b2101fdfe117d5944c143ae74e7c52 /packages/instant/src/util/assert.ts | |
parent | cc4ccda6232af470b96950a37fa1d0f4b4ef7f3a (diff) | |
parent | 6a57a7b5be151114bb06c171560976b09a8c4aa1 (diff) | |
download | dexon-sol-tools-d5521ea5e09f5a42471335b856989751b90184dc.tar dexon-sol-tools-d5521ea5e09f5a42471335b856989751b90184dc.tar.gz dexon-sol-tools-d5521ea5e09f5a42471335b856989751b90184dc.tar.bz2 dexon-sol-tools-d5521ea5e09f5a42471335b856989751b90184dc.tar.lz dexon-sol-tools-d5521ea5e09f5a42471335b856989751b90184dc.tar.xz dexon-sol-tools-d5521ea5e09f5a42471335b856989751b90184dc.tar.zst dexon-sol-tools-d5521ea5e09f5a42471335b856989751b90184dc.zip |
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/maker-asset-datas-interface
Diffstat (limited to 'packages/instant/src/util/assert.ts')
-rw-r--r-- | packages/instant/src/util/assert.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/instant/src/util/assert.ts b/packages/instant/src/util/assert.ts index 7c07215bf..d02f58625 100644 --- a/packages/instant/src/util/assert.ts +++ b/packages/instant/src/util/assert.ts @@ -4,7 +4,7 @@ import { assetDataUtils } from '@0x/order-utils'; import { AssetProxyId, ObjectMap, SignedOrder } from '@0x/types'; import * as _ from 'lodash'; -import { AssetMetaData } from '../types'; +import { AffiliateInfo, AssetMetaData } from '../types'; export const assert = { ...sharedAssert, @@ -44,4 +44,12 @@ export const assert = { assert.isUri(`${variableName}.imageUrl`, metaData.imageUrl); } }, + isValidaffiliateInfo(variableName: string, affiliateInfo: AffiliateInfo): void { + assert.isETHAddressHex(`${variableName}.recipientAddress`, affiliateInfo.feeRecipient); + assert.isNumber(`${variableName}.percentage`, affiliateInfo.feePercentage); + assert.assert( + affiliateInfo.feePercentage >= 0 && affiliateInfo.feePercentage <= 0.05, + `Expected ${variableName}.percentage to be between 0 and 0.05, but is ${affiliateInfo.feePercentage}`, + ); + }, }; |