diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-03 04:28:52 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-03 04:28:52 +0800 |
commit | d160792923c76c5bd0f61e7af2580c158dddc3d4 (patch) | |
tree | 422a523890fd1243795890d51d6b2917ec6fdc69 /packages/instant/src/util/assert.ts | |
parent | b0f2ab45e9761cc760b94d8567df8ba66956388c (diff) | |
parent | 6a57a7b5be151114bb06c171560976b09a8c4aa1 (diff) | |
download | dexon-sol-tools-d160792923c76c5bd0f61e7af2580c158dddc3d4.tar dexon-sol-tools-d160792923c76c5bd0f61e7af2580c158dddc3d4.tar.gz dexon-sol-tools-d160792923c76c5bd0f61e7af2580c158dddc3d4.tar.bz2 dexon-sol-tools-d160792923c76c5bd0f61e7af2580c158dddc3d4.tar.lz dexon-sol-tools-d160792923c76c5bd0f61e7af2580c158dddc3d4.tar.xz dexon-sol-tools-d160792923c76c5bd0f61e7af2580c158dddc3d4.tar.zst dexon-sol-tools-d160792923c76c5bd0f61e7af2580c158dddc3d4.zip |
Merge branch 'development' into fix/instant/decimal-fields-scaling-amount-input-bn
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 584d3d4b1..20f8ddaee 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, @@ -41,4 +41,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}`, + ); + }, }; |