aboutsummaryrefslogtreecommitdiffstats
path: root/packages/asset-buyer/src/utils
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-09-20 21:10:15 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-09-20 21:10:15 +0800
commit03e18ff7c60749fd33228b25077891da26e81d41 (patch)
tree4f070ec21f55816490dc9dd6a9341b8190d1063b /packages/asset-buyer/src/utils
parentd23487bda9fa918d31bb940fffb74f8be0859be5 (diff)
downloaddexon-0x-contracts-03e18ff7c60749fd33228b25077891da26e81d41.tar
dexon-0x-contracts-03e18ff7c60749fd33228b25077891da26e81d41.tar.gz
dexon-0x-contracts-03e18ff7c60749fd33228b25077891da26e81d41.tar.bz2
dexon-0x-contracts-03e18ff7c60749fd33228b25077891da26e81d41.tar.lz
dexon-0x-contracts-03e18ff7c60749fd33228b25077891da26e81d41.tar.xz
dexon-0x-contracts-03e18ff7c60749fd33228b25077891da26e81d41.tar.zst
dexon-0x-contracts-03e18ff7c60749fd33228b25077891da26e81d41.zip
Rename OrderFetcher to OrderProvider and other small improvements
Diffstat (limited to 'packages/asset-buyer/src/utils')
-rw-r--r--packages/asset-buyer/src/utils/assert.ts8
-rw-r--r--packages/asset-buyer/src/utils/asset_data_utils.ts4
-rw-r--r--packages/asset-buyer/src/utils/order_fetcher_response_processor.ts6
3 files changed, 9 insertions, 9 deletions
diff --git a/packages/asset-buyer/src/utils/assert.ts b/packages/asset-buyer/src/utils/assert.ts
index 745ba726f..1d57ae9b8 100644
--- a/packages/asset-buyer/src/utils/assert.ts
+++ b/packages/asset-buyer/src/utils/assert.ts
@@ -3,7 +3,7 @@ import { schemas } from '@0xproject/json-schemas';
import { SignedOrder } from '@0xproject/types';
import * as _ from 'lodash';
-import { BuyQuote, OrderFetcher, OrderFetcherRequest } from '../types';
+import { BuyQuote, OrderProvider, OrderProviderRequest } from '../types';
export const assert = {
...sharedAssert,
@@ -18,10 +18,10 @@ export const assert = {
sharedAssert.isNumber(`${variableName}.feePercentage`, buyQuote.feePercentage);
}
},
- isValidOrderFetcher(variableName: string, orderFetcher: OrderFetcher): void {
- sharedAssert.isFunction(`${variableName}.fetchOrdersAsync`, orderFetcher.fetchOrdersAsync);
+ isValidOrderFetcher(variableName: string, orderFetcher: OrderProvider): void {
+ sharedAssert.isFunction(`${variableName}.fetchOrdersAsync`, orderFetcher.getOrdersAsync);
},
- isValidOrderFetcherRequest(variableName: string, orderFetcherRequest: OrderFetcherRequest): void {
+ isValidOrderFetcherRequest(variableName: string, orderFetcherRequest: OrderProviderRequest): void {
sharedAssert.isHexString(`${variableName}.makerAssetData`, orderFetcherRequest.makerAssetData);
sharedAssert.isHexString(`${variableName}.takerAssetData`, orderFetcherRequest.takerAssetData);
sharedAssert.isNumber(`${variableName}.networkId`, orderFetcherRequest.networkId);
diff --git a/packages/asset-buyer/src/utils/asset_data_utils.ts b/packages/asset-buyer/src/utils/asset_data_utils.ts
index 10ff31057..d05ff2504 100644
--- a/packages/asset-buyer/src/utils/asset_data_utils.ts
+++ b/packages/asset-buyer/src/utils/asset_data_utils.ts
@@ -6,7 +6,7 @@ import { AssetBuyerError } from '../types';
export const assetDataUtils = {
...sharedAssetDataUtils,
- getEtherTokenAssetData(contractWrappers: ContractWrappers): string {
+ getEtherTokenAssetDataOrThrow(contractWrappers: ContractWrappers): string {
const etherTokenAddressIfExists = contractWrappers.etherToken.getContractAddressIfExists();
if (_.isUndefined(etherTokenAddressIfExists)) {
throw new Error(AssetBuyerError.NoEtherTokenContractFound);
@@ -14,7 +14,7 @@ export const assetDataUtils = {
const etherTokenAssetData = sharedAssetDataUtils.encodeERC20AssetData(etherTokenAddressIfExists);
return etherTokenAssetData;
},
- getZrxTokenAssetData(contractWrappers: ContractWrappers): string {
+ getZrxTokenAssetDataOrThrow(contractWrappers: ContractWrappers): string {
let zrxTokenAssetData: string;
try {
zrxTokenAssetData = contractWrappers.exchange.getZRXAssetData();
diff --git a/packages/asset-buyer/src/utils/order_fetcher_response_processor.ts b/packages/asset-buyer/src/utils/order_fetcher_response_processor.ts
index f700cadf9..98ab6b9d1 100644
--- a/packages/asset-buyer/src/utils/order_fetcher_response_processor.ts
+++ b/packages/asset-buyer/src/utils/order_fetcher_response_processor.ts
@@ -8,7 +8,7 @@ import * as _ from 'lodash';
import { constants } from '../constants';
import {
AssetBuyerOrdersAndFillableAmounts,
- OrderFetcherResponse,
+ OrderProviderResponse,
SignedOrderWithRemainingFillableMakerAssetAmount,
} from '../types';
@@ -28,8 +28,8 @@ export const orderFetcherResponseProcessor = {
* - Sort by rate
*/
async processAsync(
- targetOrderFetcherResponse: OrderFetcherResponse,
- feeOrderFetcherResponse: OrderFetcherResponse,
+ targetOrderFetcherResponse: OrderProviderResponse,
+ feeOrderFetcherResponse: OrderProviderResponse,
zrxTokenAssetData: string,
orderValidator?: OrderValidatorWrapper,
): Promise<AssetBuyerOrdersAndFillableAmounts> {